Class: Babl::Builder::BoundOperator
- Inherits:
-
Object
- Object
- Babl::Builder::BoundOperator
- Defined in:
- lib/babl/builder/chain_builder.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context, &scope) ⇒ BoundOperator
constructor
A new instance of BoundOperator.
- #nest(context) ⇒ Object
- #precompile(node) ⇒ Object
Constructor Details
#initialize(context, &scope) ⇒ BoundOperator
Returns a new instance of BoundOperator.
67 68 69 70 |
# File 'lib/babl/builder/chain_builder.rb', line 67 def initialize(context, &scope) @context = context @scope = scope || :itself.to_proc end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
65 66 67 |
# File 'lib/babl/builder/chain_builder.rb', line 65 def context @context end |
Instance Method Details
#nest(context) ⇒ Object
76 77 78 |
# File 'lib/babl/builder/chain_builder.rb', line 76 def nest(context) self.class.new(context) { |node| @scope[yield node] } end |
#precompile(node) ⇒ Object
72 73 74 |
# File 'lib/babl/builder/chain_builder.rb', line 72 def precompile(node) @scope[node] end |