Method: TextTable#lookup!

Defined in:
lib/texttable.rb

#lookup!(field) ⇒ Object



70
71
72
73
74
75
76
# File 'lib/texttable.rb', line 70

def lookup!(field)
  @rows or raise "no rows defined"
  index = index(field)
  lookup = {}
  @rows.each_with_index {|cols, i| lookup[cols[index]] = i}
  lookup
end