class Rlocu2::Menu::Subsection

Attributes

contents[RW]
subsection_name[RW]

Public Class Methods

new(subsection_hash) click to toggle source
# File lib/rlocu2/objects.rb, line 141
def initialize(subsection_hash)
  @subsection_name = subsection_hash['subsection_name']
  self.contents = subsection_hash['contents']
end

Public Instance Methods

contents=(contents_list) click to toggle source
# File lib/rlocu2/objects.rb, line 146
def contents=(contents_list)
  @contents = []
  return if contents_list.nil?
  contents_list.each do |content|
    @contents << case content['type']
                   when 'SECTION_TEXT'
                     Rlocu2::Menu::SectionText.new(content)
                   when 'ITEM'
                     Rlocu2::Menu::MenuItem.new(content)
                   else
                     raise "Menu Content type not found #{content['type']}"
                 end
  end
end