Class: Beaconable::BaseBeacon

Inherits:
Object
  • Object
show all
Defined in:
lib/beaconable/base_beacon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_metadataObject (readonly)

Returns the value of attribute beacon_metadata.



5
6
7
# File 'lib/beaconable/base_beacon.rb', line 5

def 
  @beacon_metadata
end

#objectObject (readonly)

Returns the value of attribute object.



5
6
7
# File 'lib/beaconable/base_beacon.rb', line 5

def object
  @object
end

#object_wasObject (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