Class: Beaconable::BaseBeacon
- Inherits:
-
Object
- Object
- Beaconable::BaseBeacon
- Defined in:
- lib/beaconable/base_beacon.rb
Instance Attribute Summary collapse
-
#beacon_metadata ⇒ Object
readonly
Returns the value of attribute beacon_metadata.
-
#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 11 |
# File 'lib/beaconable/base_beacon.rb', line 7 def initialize(object, object_was) @object = object @object_was = object_was @beacon_metadata = object. end |
Instance Attribute Details
#beacon_metadata ⇒ Object (readonly)
Returns the value of attribute beacon_metadata.
5 6 7 |
# File 'lib/beaconable/base_beacon.rb', line 5 def @beacon_metadata end |
#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
13 14 15 16 17 |
# File 'lib/beaconable/base_beacon.rb', line 13 def field_changed(field) @field = field @result = field_changed? field self end |
#from(*values) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/beaconable/base_beacon.rb', line 19 def from(*values) return self unless @result @result = values.include? object_was.send(@field) self end |
#to(*values) ⇒ Object
26 27 28 |
# File 'lib/beaconable/base_beacon.rb', line 26 def to(*values) @result && values.include?(object.send(@field)) end |