Method: Alf::Renderer::Text#each

Defined in:
lib/alf/renderer/text.rb

#each(&bl) ⇒ Object

class Table



161
162
163
164
165
166
167
168
169
# File 'lib/alf/renderer/text.rb', line 161

def each(&bl)
  input    = self.input
  input    = [input.to_hash] if TupleLike===input
  relation = input.to_a
  attrs    = relation.inject([]){|memo,t| (memo | t.keys)}
  records  = relation.map{|t| attrs.map{|a| t[a]}}
  table    = Table.new(records, attrs, options)
  table.each(&bl)
end