Class: SensoroBeacon

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

Constant Summary collapse

Properties =
[:uuid, :major, :minor, :serial_number, :battery_level, :firmware_version, :temperature, :light, :accelerometer_count, :accuracy, :rssi, :model_name]

Instance Method Summary collapse

Instance Method Details

#<=>(obj) ⇒ Object



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

def <=>(obj)
  obj.is_a?(SensoroBeacon) ? serial_number <=> obj.serial_number : 1
end

#inspectObject



15
16
17
# File 'lib/sensoro_beacon.rb', line 15

def inspect
  "<SensoroBeacon #{to_h.to_a.map { |k, v| "#{k}=#{v}" }.join(' ')}>"
end

#to_hObject



9
10
11
12
13
# File 'lib/sensoro_beacon.rb', line 9

def to_h
  hash = {}
  Properties.each { |x| hash[x] = send(x) }
  hash
end