Class: Iba::Combinator
- Inherits:
-
Object
- Object
- Iba::Combinator
- Defined in:
- lib/iba.rb
Instance Method Summary collapse
- #analyse ⇒ Object
- #call ⇒ Object
- #expression ⇒ Object
-
#initialize(&blk) ⇒ Combinator
constructor
A new instance of Combinator.
- #to_s ⇒ Object
Constructor Details
#initialize(&blk) ⇒ Combinator
Returns a new instance of Combinator.
7 8 9 |
# File 'lib/iba.rb', line 7 def initialize(&blk) @block = blk end |
Instance Method Details
#analyse ⇒ Object
23 24 25 26 27 28 |
# File 'lib/iba.rb', line 23 def analyse str = +"#{self} is #{call.inspect}" sub = expression._display_subexpressions(@block.binding) str << "\n#{sub}" if sub str end |
#call ⇒ Object
11 12 13 |
# File 'lib/iba.rb', line 11 def call @block.call end |
#expression ⇒ Object
19 20 21 |
# File 'lib/iba.rb', line 19 def expression @expression ||= EmptyExpression.new._parse(&@block) end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/iba.rb', line 15 def to_s expression._to_s end |