class SinglePlatform::Menu

Attributes

attribution_image[R]
desc[R]
disclaimer[R]
entries[R]
footnote[R]
id[R]
location[R]
menu_sections[R]
name[R]
secure_attribution_image[R]
state[R]
title[R]

Public Class Methods

menus_for_location(location) click to toggle source
new(location, data) click to toggle source
# File lib/single_platform/menu.rb, line 7
def initialize(location, data)
  @location = location
  @menu_sections = []
  data.each do |key, value|
    instance_variable_set :"@#{key.underscore}", value
  end
  build_menu
end

Public Instance Methods

build_menu() click to toggle source
# File lib/single_platform/menu.rb, line 21
def build_menu
  current_section = nil
  entries.each do |entry|
    if entry["type"] == "section"
      current_section = SinglePlatform::MenuSection.new(self, entry)
      menu_sections << current_section
    else
      current_section.menu_items << SinglePlatform::MenuItem.new(current_section, entry)
    end
  end
end