Class: ERLE::Tuple

Inherits:
Enum show all
Defined in:
lib/erle/elements/tuple.rb

Instance Attribute Summary collapse

Attributes inherited from Enum

#terms

Attributes inherited from Term

#input, #output

Instance Method Summary collapse

Methods inherited from Enum

delimeter_regex, parse, until_delimeter

Methods inherited from Term

enclosure, parse, pattern, to_ruby, until_any_closing

Constructor Details

#initialize(elements) ⇒ Tuple

Returns a new instance of Tuple.



9
10
11
12
# File 'lib/erle/elements/tuple.rb', line 9

def initialize(elements)
  super
  @key = Term.to_ruby(@terms.shift)
end

Instance Attribute Details

#keyObject

Returns the value of attribute key.



7
8
9
# File 'lib/erle/elements/tuple.rb', line 7

def key
  @key
end

Instance Method Details

#to_rubyObject



14
15
16
# File 'lib/erle/elements/tuple.rb', line 14

def to_ruby
  @output ||= { @key => one_or_all(terms_to_ruby) }
end