Module: Rack::App::FrontEnd::Helpers::Table

Included in:
Rack::App::FrontEnd::Helpers
Defined in:
lib/rack/app/front_end/helpers/table.rb

Defined Under Namespace

Modules: Builder

Instance Method Summary collapse

Instance Method Details

#table_by(object, attributes = {}) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/rack/app/front_end/helpers/table.rb', line 50

def table_by(object, attributes={})
  if object.is_a?(Array) && object.all? { |e| e.is_a?(Hash) }
    Builder.from_array_of_hash(object, attributes)
  elsif object.is_a?(Hash)
    Builder.from_hash(object, attributes)
  else
    raise("don't know how to build table from this: #{object}")
  end
end