Class: Acb::Column

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, **options) ⇒ Column

Returns a new instance of Column.



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/acb/column.rb', line 7

def initialize(name, **options)
  @name = name
  @index = case options[:index]
           when Proc
             options[:index]
           when String
             options[:index].split('.')
           else
             [name]
           end
  @format = options[:format]
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/acb/column.rb', line 5

def name
  @name
end

Instance Method Details

#digest(row) ⇒ Object



20
21
22
23
# File 'lib/acb/column.rb', line 20

def digest(row)
  data = _digest(row)
  @format && data ? format(data) : data
end