class Csb::Cols
Attributes
cols[R]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/csb/cols.rb, line 10 def initialize @cols = [] yield(self) if block_given? end
Public Instance Methods
add(*args, &block)
click to toggle source
# File lib/csb/cols.rb, line 23 def add(*args, &block) cols << Col.new(*args, &block) end
as_table(items)
click to toggle source
# File lib/csb/testing.rb, line 7 def as_table(items) [headers] + items.map { |item| values(item) } end
col_pairs(item)
click to toggle source
# File lib/csb/testing.rb, line 3 def col_pairs(item) headers.zip(values(item)) end
copy!(other)
click to toggle source
# File lib/csb/cols.rb, line 15 def copy!(other) @cols = other.cols.deep_dup end
each(&block)
click to toggle source
# File lib/csb/cols.rb, line 19 def each(&block) cols.each(&block) end
headers()
click to toggle source
# File lib/csb/cols.rb, line 27 def headers map(&:name) end
values_by_item(item)
click to toggle source
# File lib/csb/cols.rb, line 31 def values_by_item(item) map do |col| col.value_by_item(item) end end
Also aliased as: values