Class: Beaconable::BaseBeacon
- Inherits:
-
Object
- Object
- Beaconable::BaseBeacon
- Defined in:
- lib/beaconable/base_beacon.rb
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#object_was ⇒ Object
readonly
Returns the value of attribute object_was.
Instance Method Summary collapse
- #field_changed(field) ⇒ Object
- #from(*values) ⇒ Object
-
#initialize(object, object_was) ⇒ BaseBeacon
constructor
A new instance of BaseBeacon.
- #to(*values) ⇒ Object
Constructor Details
#initialize(object, object_was) ⇒ BaseBeacon
Returns a new instance of BaseBeacon.
7 8 9 10 |
# File 'lib/beaconable/base_beacon.rb', line 7 def initialize(object, object_was) @object = object @object_was = object_was end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/beaconable/base_beacon.rb', line 5 def object @object end |
#object_was ⇒ Object (readonly)
Returns the value of attribute object_was.
5 6 7 |
# File 'lib/beaconable/base_beacon.rb', line 5 def object_was @object_was end |
Instance Method Details
#field_changed(field) ⇒ Object
12 13 14 15 16 |
# File 'lib/beaconable/base_beacon.rb', line 12 def field_changed(field) @field = field @result = field_changed? field self end |
#from(*values) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/beaconable/base_beacon.rb', line 18 def from(*values) return self unless @result @result = values.include? object_was.send(@field) self end |
#to(*values) ⇒ Object
25 26 27 |
# File 'lib/beaconable/base_beacon.rb', line 25 def to(*values) @result && values.include?(object.send(@field)) end |