Module: Chell::ReinforcedCSVTable

Defined in:
lib/chell.rb

Instance Method Summary collapse

Instance Method Details

#col(index = 0, &block) ⇒ Object



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

def col(index = 0, &block)
  map_wrapper(block){ map{|x| x[index] } }
end

#col!(index = 0, &block) ⇒ Object



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

def col!(index = 0, &block)
  map.with_index{|x,i| x[index] = (yield x[index], i) } if block_given?
end

#csvObject

Alias methods



39
# File 'lib/chell.rb', line 39

def csv; self; end

#hObject



42
# File 'lib/chell.rb', line 42

def h; headers; end

#lObject



41
# File 'lib/chell.rb', line 41

def l; length; end

#row(index = 0, &block) ⇒ Object



30
31
32
# File 'lib/chell.rb', line 30

def row(index = 0, &block)
  map_wrapper(block){ self[index] }
end

#sObject



40
# File 'lib/chell.rb', line 40

def s; size; end

#write(filename) ⇒ Object



34
35
36
# File 'lib/chell.rb', line 34

def write(filename)
  File.write(filename, self.to_csv(write_headers: true))
end