Class: Beaconable::ObjectWas
- Inherits:
-
Object
- Object
- Beaconable::ObjectWas
- Defined in:
- lib/beaconable/object_was.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(object) ⇒ ObjectWas
constructor
A new instance of ObjectWas.
Constructor Details
#initialize(object) ⇒ ObjectWas
Returns a new instance of ObjectWas.
7 8 9 |
# File 'lib/beaconable/object_was.rb', line 7 def initialize(object) @object = object end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/beaconable/object_was.rb', line 5 def object @object end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 |
# 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 |