Class: Itiel::Transform::ConstantColumn

Inherits:
Object
  • Object
show all
Includes:
Nameable, ChainedStep
Defined in:
lib/itiel/transform/constant_column.rb

Overview

The resulting stream will have a column named “column” with the value “Constant Value” for all rows.

Instance Attribute Summary collapse

Attributes included from Nameable

#debug, #step_name

Attributes included from ChainedStep

#next_step

Instance Method Summary collapse

Methods included from ChainedStep

#input=

Constructor Details

#initialize(*args) ⇒ ConstantColumn

Returns a new instance of ConstantColumn.



24
25
26
# File 'lib/itiel/transform/constant_column.rb', line 24

def initialize(*args)
  self.append = args.first
end

Instance Attribute Details

#appendObject

Returns the value of attribute append.



22
23
24
# File 'lib/itiel/transform/constant_column.rb', line 22

def append
  @append
end

Instance Method Details

#transform!(input_stream) ⇒ Object



28
29
30
31
32
# File 'lib/itiel/transform/constant_column.rb', line 28

def transform!(input_stream)
  input_stream.collect do |row|
    row.merge(self.append)
  end
end