Class: DParse::Parsers::Lazy
- Inherits:
-
DParse::Parser
- Object
- DParse::Parser
- DParse::Parsers::Lazy
- Defined in:
- lib/d-parse/parsers/modifiers/lazy.rb
Instance Method Summary collapse
-
#initialize(&block) ⇒ Lazy
constructor
A new instance of Lazy.
- #inspect ⇒ Object
- #read(input, pos) ⇒ Object
Methods inherited from DParse::Parser
#apply, #bind, #capture, #compact, #expectation_message, #first, #flatten, #ignore, #map, #match?, #second, #select_even, #select_odd, #to_s
Constructor Details
#initialize(&block) ⇒ Lazy
Returns a new instance of Lazy.
4 5 6 7 |
# File 'lib/d-parse/parsers/modifiers/lazy.rb', line 4 def initialize(&block) raise ArgumentError, 'Expected block' unless block_given? @block = block end |
Instance Method Details
#inspect ⇒ Object
13 14 15 |
# File 'lib/d-parse/parsers/modifiers/lazy.rb', line 13 def inspect 'lazy(?)' end |
#read(input, pos) ⇒ Object
9 10 11 |
# File 'lib/d-parse/parsers/modifiers/lazy.rb', line 9 def read(input, pos) @block.call.read(input, pos) end |