Class: XapTreetop::Message
- Inherits:
-
Treetop::Runtime::SyntaxNode
- Object
- Treetop::Runtime::SyntaxNode
- XapTreetop::Message
- Defined in:
- lib/xap/parser/xap_nodes.rb
Instance Method Summary collapse
-
#first_block ⇒ Object
Returns the name of the first message block.
- #to_hash ⇒ Object
- #to_s ⇒ Object
Instance Method Details
#first_block ⇒ Object
Returns the name of the first message block
91 92 93 94 95 96 97 98 |
# File 'lib/xap/parser/xap_nodes.rb', line 91 def first_block elements.each do |el| if el.is_a? MessageBlock return el.keyword.text_value end end nil end |
#to_hash ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'lib/xap/parser/xap_nodes.rb', line 100 def to_hash h = {} elements.each do |el| if el.is_a? MessageBlock h[el.keyword.text_value] = el.values end end h end |
#to_s ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'lib/xap/parser/xap_nodes.rb', line 110 def to_s s = "" elements.each do |el| if el.is_a? MessageBlock s << el.to_s end end s end |