Class: XapTreetop::Pairs

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

Instance Method Summary collapse

Instance Method Details

#to_hashObject



51
52
53
54
55
56
57
58
59
# File 'lib/xap/parser/xap_nodes.rb', line 51

def to_hash
	h = {}
	elements.each do |el|
		if el.is_a? KeyValuePair
			h[el.key] = el.val
		end
	end
	h
end

#to_sObject



61
62
63
64
65
66
67
68
69
# File 'lib/xap/parser/xap_nodes.rb', line 61

def to_s
	s = ''
	elements.each do |el|
		if el.is_a? KeyValuePair
			s << "#{el.to_s}\n"
		end
	end
	s
end