module Nazar::Formatter::SequelInterface

Attributes

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

Public Instance Methods

cells() click to toggle source
# File lib/nazar/formatter/sequel_interface.rb, line 16
def cells
  @cells ||= begin
    schema = collection.first.db_schema

    collection.map do |item|
      item.values.map do |column, value|
        CellFormatter.new(value, type: schema.dig(column, :type)).format
      end
    end
  end
end
headers() click to toggle source
# File lib/nazar/formatter/sequel_interface.rb, line 12
def headers
  HeadersFormatter.new(attributes.keys).format
end
summary() click to toggle source
# File lib/nazar/formatter/sequel_interface.rb, line 28
def summary
  collection.size
end
valid?() click to toggle source
# File lib/nazar/formatter/sequel_interface.rb, line 8
def valid?
  !!attributes
end