class Beaconable::ObjectWas

Attributes

object[R]

Public Class Methods

new(object) click to toggle source
# File lib/beaconable/object_was.rb, line 7
def initialize(object)
  @object = object
end

Public Instance Methods

call() click to toggle source
# File lib/beaconable/object_was.rb, line 11
def call
  hashed_object = {}
  symbolized_column_names = object.class.column_names.map(&:to_sym)
  symbolized_column_names.each do |column_name|
    hashed_object[column_name] = object.send("#{column_name}_was")
  end
  OpenStruct.new(hashed_object)
end