Class: ERLE::Ref
Instance Attribute Summary
Attributes inherited from Term
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(input) ⇒ Ref
constructor
A new instance of Ref.
-
#to_ruby ⇒ Object
TODO: Leverage Enum, and refactor (Enum) to handle conflicting delimiters e.g.
Methods inherited from Term
enclosure, pattern, to_ruby, until_any_closing
Constructor Details
#initialize(input) ⇒ Ref
Returns a new instance of Ref.
10 11 12 |
# File 'lib/erle/elements/ref.rb', line 10 def initialize(input) @input = input end |
Class Method Details
.parse(parser) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/erle/elements/ref.rb', line 20 def self.parse(parser) result = parser.scan(@pattern) if close && !parser.scan(close) raise parser.raise_unexpected_token("Expected term closure \" #{close.source} \"") end # Make sure we kill any trailing close # TODO: Consider raising if no match? # TODO: Consider doing only if we started with an opening... # parser.scan(ERLE::Registry.closings_regex) new(result) end |
Instance Method Details
#to_ruby ⇒ Object
TODO: Leverage Enum, and refactor (Enum) to handle conflicting delimiters e.g. a “.” delimeter is preempted by the “float” pattern.
16 17 18 |
# File 'lib/erle/elements/ref.rb', line 16 def to_ruby @output ||= @input.split(".") end |