Module: Mingo::Changes

Included in:
Mingo
Defined in:
lib/mingo/changes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



7
8
9
# File 'lib/mingo/changes.rb', line 7

def changes
  @changes
end

Class Method Details

.included(base) ⇒ Object



3
4
5
# File 'lib/mingo/changes.rb', line 3

def self.included(base)
  base.after_save :clear_changes
end

Instance Method Details

#[]=(key, value) ⇒ Object



14
15
16
17
# File 'lib/mingo/changes.rb', line 14

def []=(key, value)
  record_change(key, value)
  super
end

#changed?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/mingo/changes.rb', line 19

def changed?
  changes.any?
end

#initialize(*args) ⇒ Object



9
10
11
12
# File 'lib/mingo/changes.rb', line 9

def initialize(*args)
  @changes = {}
  super
end