Class: Nazar::Formatter::ActiveRecordItem

Inherits:
Object
  • Object
show all
Includes:
ActiveRecordInterface
Defined in:
lib/nazar/formatter/active_record_item.rb

Instance Attribute Summary

Attributes included from ActiveRecordInterface

#attributes, #collection, #klass

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ActiveRecordInterface

#cells, #headers, #valid?

Constructor Details

#initialize(item) ⇒ ActiveRecordItem

Returns a new instance of ActiveRecordItem.



10
11
12
13
14
# File 'lib/nazar/formatter/active_record_item.rb', line 10

def initialize(item)
  @collection = [item]
  @attributes = item.attributes
  @klass = item.class
end

Class Method Details

.valid?(data) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/nazar/formatter/active_record_item.rb', line 16

def self.valid?(data)
  data.is_a?(ActiveRecord::Base)
end

Instance Method Details

#summaryObject



20
21
22
# File 'lib/nazar/formatter/active_record_item.rb', line 20

def summary
  false
end