Class: Babl::Nodes::Each
- Inherits:
-
Object
- Object
- Babl::Nodes::Each
- Defined in:
- lib/babl/nodes/each.rb
Instance Method Summary collapse
Instance Method Details
#dependencies ⇒ Object
8 9 10 |
# File 'lib/babl/nodes/each.rb', line 8 def dependencies { __each__: node.dependencies } end |
#pinned_dependencies ⇒ Object
16 17 18 |
# File 'lib/babl/nodes/each.rb', line 16 def pinned_dependencies node.pinned_dependencies end |
#render(ctx) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/babl/nodes/each.rb', line 20 def render(ctx) collection = ctx.object unless Enumerable === collection raise Errors::RenderingError, "Not enumerable : #{collection}\n#{ctx.formatted_stack}" end collection.each_with_index.map { |value, idx| node.render(ctx.move_forward(value, idx)) } end |
#schema ⇒ Object
12 13 14 |
# File 'lib/babl/nodes/each.rb', line 12 def schema Schema::DynArray.new(node.schema) end |