Class: Mxrb::Model::Menu

Inherits:
Unit
  • Object
show all
Defined in:
lib/mxrb/model/menu.rb

Instance Attribute Summary collapse

Attributes inherited from Unit

#bson_type, #container_id, #containment_name, #id, #mpr

Instance Method Summary collapse

Methods inherited from Unit

#initialize, #save!, #to_bson

Constructor Details

This class inherits a constructor from Mxrb::Model::Unit

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



8
9
10
# File 'lib/mxrb/model/menu.rb', line 8

def items
  @items
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/mxrb/model/menu.rb', line 8

def name
  @name
end

#raw_documentObject (readonly)

Returns the value of attribute raw_document.



8
9
10
# File 'lib/mxrb/model/menu.rb', line 8

def raw_document
  @raw_document
end

Instance Method Details

#decode(doc) ⇒ Object



10
11
12
13
14
15
# File 'lib/mxrb/model/menu.rb', line 10

def decode(doc)
  @raw_document = doc
  @name = doc["Name"]
  collection = doc["ItemCollection"] || {}
  @items = parse_array(collection["Items"]).map { menu_item(_1) }
end