Class: Csb::Cols
Instance Attribute Summary collapse
-
#cols ⇒ Object
readonly
Returns the value of attribute cols.
Instance Method Summary collapse
- #add(*args, &block) ⇒ Object
- #copy!(other) ⇒ Object
- #each(&block) ⇒ Object
- #headers ⇒ Object
-
#initialize ⇒ Cols
constructor
A new instance of Cols.
- #values_by_item(item) ⇒ Object
Constructor Details
#initialize ⇒ Cols
Returns a new instance of Cols.
10 11 12 |
# File 'lib/csb/cols.rb', line 10 def initialize @cols = [] end |
Instance Attribute Details
#cols ⇒ Object (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 |
#headers ⇒ Object
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 |