module Nazar::Formatter::ActiveRecordInterface

Attributes

attributes[R]
collection[R]
klass[R]

Public Instance Methods

cells() click to toggle source
# File lib/nazar/formatter/active_record_interface.rb, line 16
def cells
  @cells ||= collection.map do |item|
    item.attributes.map do |column, value|
      CellFormatter.new(value, type: klass.type_for_attribute(column).type).format
    end
  end
end
headers() click to toggle source
# File lib/nazar/formatter/active_record_interface.rb, line 12
def headers
  HeadersFormatter.new(attributes.keys).format
end
valid?() click to toggle source
# File lib/nazar/formatter/active_record_interface.rb, line 8
def valid?
  !!(attributes && klass)
end