Module: Wal::ChangeEvent

Included in:
DeleteEvent, InsertEvent, UpdateEvent
Defined in:
lib/wal.rb

Instance Method Summary collapse

Instance Method Details

#attribute(attribute) ⇒ Object



79
80
81
82
83
# File 'lib/wal.rb', line 79

def attribute(attribute)
  if (changes = diff[attribute.to_s])
    changes[1]
  end
end

#attribute_changes(attribute) ⇒ Object



85
86
87
# File 'lib/wal.rb', line 85

def attribute_changes(attribute)
  diff[attribute.to_s]
end

#attribute_was(attribute) ⇒ Object



89
90
91
92
93
# File 'lib/wal.rb', line 89

def attribute_was(attribute)
  if (changes = diff[attribute.to_s])
    changes[0]
  end
end

#changed_attribute?(attribute) ⇒ Boolean

Returns:

  • (Boolean)


75
76
77
# File 'lib/wal.rb', line 75

def changed_attribute?(attribute)
  diff.key? attribute.to_s
end

#diffObject



71
72
73
# File 'lib/wal.rb', line 71

def diff
  {}
end