Class: Seiun::Callback::RecordWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/seiun/callback/record_wrapper.rb

Instance Method Summary collapse

Constructor Details

#initialize(record) ⇒ RecordWrapper

Returns a new instance of RecordWrapper.



4
5
6
# File 'lib/seiun/callback/record_wrapper.rb', line 4

def initialize(record)
  @record = record
end

Instance Method Details

#to_hashObject



8
9
10
11
12
13
14
15
16
# File 'lib/seiun/callback/record_wrapper.rb', line 8

def to_hash
  if callback_defined?(:hashalize)
    @record.__send__(:hashalize)
  elsif @record.respond_to?(:to_hash)
    @record.to_hash
  else
    @record
  end
end