Module: Wal::ChangeEvent

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

Instance Method Summary collapse

Instance Method Details

#attribute(attribute) ⇒ Object



52
53
54
55
56
# File 'lib/wal.rb', line 52

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

#attribute_changes(attribute) ⇒ Object



58
59
60
# File 'lib/wal.rb', line 58

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

#attribute_was(attribute) ⇒ Object



62
63
64
65
66
# File 'lib/wal.rb', line 62

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

#changed_attribute?(attribute) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/wal.rb', line 48

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

#diffObject



44
45
46
# File 'lib/wal.rb', line 44

def diff
  {}
end