Class: Portable::Modeling::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/portable/modeling/column.rb

Overview

Defines all the options a column can contain. The most basic would to just include a header (defaults to ”). If no transformers are defined then a simple resolver using the header will be used. This works well for pass-through file writes. Use the transformers to further customize each data point being written.

Constant Summary collapse

DEFAULT_TRANSFORMER_TYPE =
'r/value/resolve'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header: '', transformers: []) ⇒ Column

Returns a new instance of Column.



23
24
25
26
27
28
29
30
# File 'lib/portable/modeling/column.rb', line 23

def initialize(header: '', transformers: [])
  @header       = header.to_s
  @transformers = Realize::Transformers.array(transformers)

  @transformers << default_transformer if @transformers.empty?

  freeze
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



21
22
23
# File 'lib/portable/modeling/column.rb', line 21

def header
  @header
end

#transformersObject (readonly)

Returns the value of attribute transformers.



21
22
23
# File 'lib/portable/modeling/column.rb', line 21

def transformers
  @transformers
end