Class: Ambient::DeviceInfo

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, coords) ⇒ DeviceInfo

Returns a new instance of DeviceInfo.



11
12
13
14
# File 'lib/ambient/device.rb', line 11

def initialize(name, coords)
  @name = name
  @coords = coords
end

Instance Attribute Details

#coordsObject (readonly)

Returns the value of attribute coords.



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

def coords
  @coords
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

Class Method Details

.from_hash(data) ⇒ Object



7
8
9
# File 'lib/ambient/device.rb', line 7

def self.from_hash(data)
  DeviceInfo.new(data.dig("name"), data.dig("coords"))
end