Class: Cocoadex::SequentialNodeElement
- Defined in:
- lib/cocoadex/models/seq_node_element.rb
Overview
An element of a section where each item is divided by anchor tags
Direct Known Subclasses
Constant Summary collapse
- Abstract =
->(node) { node.classes.include? "abstract" }
- Declaration =
->(node) { node.classes.include? "declaration" }
- ReturnValue =
->(node) { node.classes.include? "return_value" }
- Discussion =
->(node) { node.classes.include? "discussion" }
- Availability =
->(node) { node.classes.include? "availability" }
- DeclaredIn =
->(node) { node.classes.include? "declaredIn" }
- Special =
->(node) { node.classes.include? "specialConsiderations" }
Instance Attribute Summary
Attributes inherited from Element
Instance Method Summary collapse
- #handle_node(node) ⇒ Object
-
#initialize(origin, title_node) ⇒ SequentialNodeElement
constructor
A new instance of SequentialNodeElement.
- #origin ⇒ Object
- #parse(title_node) ⇒ Object
Methods inherited from Element
#<=>, #parse_parameters, #print, #to_s, #type
Methods included from Bri::Templates::Helpers
Constructor Details
#initialize(origin, title_node) ⇒ SequentialNodeElement
Returns a new instance of SequentialNodeElement.
14 15 16 17 18 |
# File 'lib/cocoadex/models/seq_node_element.rb', line 14 def initialize origin, title_node @origin = origin @name = title_node.text parse(title_node) end |
Instance Method Details
#handle_node(node) ⇒ Object
49 50 51 |
# File 'lib/cocoadex/models/seq_node_element.rb', line 49 def handle_node node logger.debug("Unhandled #{self.class} property: #{classes} => #{node.text}") end |
#origin ⇒ Object
20 21 22 |
# File 'lib/cocoadex/models/seq_node_element.rb', line 20 def origin @origin end |
#parse(title_node) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/cocoadex/models/seq_node_element.rb', line 24 def parse title_node prev_node = title_node while node = prev_node.next and node.name != "a" case node when Abstract @abstract = node.text when Declaration @declaration = node.text when Availability @availability = node.text.sub("Availability","") when ReturnValue @return_value = node.text.sub("Return Value","") when Discussion @discussion = node.text.sub("Discussion","") when DeclaredIn @declared_in = node.text.sub("Declared In","") when Special @considerations = node.text.sub("Special Considerations","") else handle_node(node) end prev_node = node end end |