Class: Crm::Core::Mixins::ChangeLoggable::Change
- Inherits:
-
Object
- Object
- Crm::Core::Mixins::ChangeLoggable::Change
- Includes:
- AttributeProvider
- Defined in:
- lib/crm/core/mixins/change_loggable.rb
Overview
Change
represents a single change log entry contained in item.changes. See ChangeLoggable for details.
Defined Under Namespace
Classes: Detail
Instance Attribute Summary collapse
-
#changed_at ⇒ Time
readonly
Returns the timestamp of the change to the item.
-
#changed_by ⇒ String
readonly
Returns the login of the API user who made the change.
-
#details ⇒ Array<Detail>
readonly
Returns the details of the change (i.e.
before
andafter
of every changed attribute).
Instance Method Summary collapse
-
#initialize(raw_change) ⇒ Change
constructor
A new instance of Change.
Methods included from AttributeProvider
#[], #attributes, #method_missing, #methods, #raw, #respond_to_missing?
Constructor Details
#initialize(raw_change) ⇒ Change
Returns a new instance of Change.
42 43 44 45 46 47 48 |
# File 'lib/crm/core/mixins/change_loggable.rb', line 42 def initialize(raw_change) change = raw_change.dup change['details'] = change['details'].each_with_object({}) do |(attr_name, detail), hash| hash[attr_name] = Detail.new(detail) end super(change) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Crm::Core::Mixins::AttributeProvider
Instance Attribute Details
#changed_at ⇒ Time (readonly)
Returns the timestamp of the change to the item.
|
# File 'lib/crm/core/mixins/change_loggable.rb', line 50
|
#changed_by ⇒ String (readonly)
Returns the login of the API user who made the change.
|
# File 'lib/crm/core/mixins/change_loggable.rb', line 55
|
#details ⇒ Array<Detail> (readonly)
Returns the details of the change (i.e. before
and after
of every changed attribute)
|
# File 'lib/crm/core/mixins/change_loggable.rb', line 60
|