Class: Yesterday::VersionedAttribute

Inherits:
Struct
  • Object
show all
Defined in:
lib/yesterday/versioned_attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#diffObject

Returns the value of attribute diff

Returns:

  • (Object)

    the current value of diff



2
3
4
# File 'lib/yesterday/versioned_attribute.rb', line 2

def diff
  @diff
end

Instance Method Details

#currentObject



4
5
6
# File 'lib/yesterday/versioned_attribute.rb', line 4

def current
  diff.last
end

#modified?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/yesterday/versioned_attribute.rb', line 12

def modified?
  current != previous
end

#previousObject



8
9
10
# File 'lib/yesterday/versioned_attribute.rb', line 8

def previous
  diff.first
end

#to_iObject



20
21
22
# File 'lib/yesterday/versioned_attribute.rb', line 20

def to_i
  current.to_i
end

#to_sObject



16
17
18
# File 'lib/yesterday/versioned_attribute.rb', line 16

def to_s
  current.to_s
end