Class: Alf::Engine::InferHeading

Inherits:
Object
  • Object
show all
Includes:
Cog
Defined in:
lib/alf-engine/alf/engine/infer_heading.rb

Overview

Infers the heading of the iterated relation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Cog

#each, #to_dot, #to_relation

Constructor Details

#initialize(operand) ⇒ InferHeading

Returns a new instance of InferHeading.



12
13
14
# File 'lib/alf-engine/alf/engine/infer_heading.rb', line 12

def initialize(operand)
  @operand = operand
end

Instance Attribute Details

#operandEnumerable (readonly)

Returns The operand.

Returns:

  • (Enumerable)

    The operand



10
11
12
# File 'lib/alf-engine/alf/engine/infer_heading.rb', line 10

def operand
  @operand
end

Instance Method Details

#_each {|heading.to_h| ... } ⇒ Object

Yields:

  • (heading.to_h)


16
17
18
19
# File 'lib/alf-engine/alf/engine/infer_heading.rb', line 16

def _each
  heading = operand.inject(Alf::Heading::EMPTY){|h,t| h + heading(t) }
  yield(heading.to_h)
end