Class: MenuMarkupParser::Section
- Defined in:
- lib/menu_markup_parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#description_lines ⇒ Object
readonly
Returns the value of attribute description_lines.
-
#prices ⇒ Object
readonly
Returns the value of attribute prices.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
- #children ⇒ Object
- #choice? ⇒ Boolean
- #description ⇒ Object
- #parse_elements! ⇒ Object
- #restrictions ⇒ Object
- #spicy ⇒ Object
Instance Attribute Details
#description_lines ⇒ Object (readonly)
Returns the value of attribute description_lines.
25 26 27 |
# File 'lib/menu_markup_parser.rb', line 25 def description_lines @description_lines end |
#prices ⇒ Object (readonly)
Returns the value of attribute prices.
25 26 27 |
# File 'lib/menu_markup_parser.rb', line 25 def prices @prices end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
25 26 27 |
# File 'lib/menu_markup_parser.rb', line 25 def title @title end |
Instance Method Details
#children ⇒ Object
51 52 53 |
# File 'lib/menu_markup_parser.rb', line 51 def children children_nodes.elements end |
#choice? ⇒ Boolean
47 48 49 |
# File 'lib/menu_markup_parser.rb', line 47 def choice? choice_node.text_value.present? end |
#description ⇒ Object
27 28 29 |
# File 'lib/menu_markup_parser.rb', line 27 def description description_lines.join("\n") end |
#parse_elements! ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/menu_markup_parser.rb', line 39 def parse_elements! @description_lines = description_node.elements.collect { |node| node.text.text_value.strip } @prices = parse_prices! @title = @description_lines.shift children.each { |node| node.parse_elements! } end |
#restrictions ⇒ Object
31 32 33 |
# File 'lib/menu_markup_parser.rb', line 31 def restrictions attributes_node.respond_to?(:attributes) ? attributes_node.attributes.restrictions : [] end |
#spicy ⇒ Object
35 36 37 |
# File 'lib/menu_markup_parser.rb', line 35 def spicy attributes_node.respond_to?(:attributes) ? attributes_node.attributes.spicy : nil end |