Class: Csb::Cols

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/csb/cols.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCols

Returns a new instance of Cols.



10
11
12
# File 'lib/csb/cols.rb', line 10

def initialize
  @cols = []
end

Instance Attribute Details

#colsObject (readonly)

Returns the value of attribute cols.



8
9
10
# File 'lib/csb/cols.rb', line 8

def cols
  @cols
end

Instance Method Details

#add(*args, &block) ⇒ Object



22
23
24
# File 'lib/csb/cols.rb', line 22

def add(*args, &block)
  cols << Col.new(*args, &block)
end

#copy!(other) ⇒ Object



14
15
16
# File 'lib/csb/cols.rb', line 14

def copy!(other)
  @cols = other.cols.deep_dup
end

#each(&block) ⇒ Object



18
19
20
# File 'lib/csb/cols.rb', line 18

def each(&block)
  cols.each(&block)
end

#headersObject



26
27
28
# File 'lib/csb/cols.rb', line 26

def headers
  map(&:name)
end

#values_by_item(item) ⇒ Object



30
31
32
33
34
# File 'lib/csb/cols.rb', line 30

def values_by_item(item)
  map do |col|
    col.value_by_item(item)
  end
end