Class: XapTreetop::Message

Inherits:
Treetop::Runtime::SyntaxNode
  • Object
show all
Defined in:
lib/xap/parser/xap_nodes.rb

Instance Method Summary collapse

Instance Method Details

#first_blockObject

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_hashObject



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_sObject



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