Class: Alf::Engine::InferHeading
- Inherits:
-
Object
- Object
- Alf::Engine::InferHeading
- Includes:
- Cog
- Defined in:
- lib/alf/engine/infer_heading.rb
Overview
Infers the heading of the iterated relation.
Constant Summary
Constants included from Cog
Cog::EMPTY_CHILDREN, Cog::EMPTY_OPTIONS
Instance Attribute Summary collapse
-
#operand ⇒ Enumerable
readonly
The operand.
Attributes included from Compiler::Cog
Instance Method Summary collapse
- #_each {|heading.to_h| ... } ⇒ Object
-
#initialize(operand, expr = nil, compiler = nil) ⇒ InferHeading
constructor
A new instance of InferHeading.
Methods included from Cog
#arguments, #children, #each, #options, #to_s
Methods included from Compiler::Cog
#cog_orders, #orderedby?, #relation_type, #to_ascii_tree, #to_cog, #to_relation
Constructor Details
#initialize(operand, expr = nil, compiler = nil) ⇒ InferHeading
12 13 14 15 |
# File 'lib/alf/engine/infer_heading.rb', line 12 def initialize(operand, expr = nil, compiler = nil) super(expr, compiler) @operand = operand end |
Instance Attribute Details
#operand ⇒ Enumerable (readonly)
10 11 12 |
# File 'lib/alf/engine/infer_heading.rb', line 10 def operand @operand end |
Instance Method Details
#_each {|heading.to_h| ... } ⇒ Object
17 18 19 20 |
# File 'lib/alf/engine/infer_heading.rb', line 17 def _each heading = operand.inject(Alf::Heading::EMPTY){|h,t| h + heading(t) } yield(heading.to_h) end |