Class: S2D::Mappers::DeviceMapper
- Inherits:
-
Object
- Object
- S2D::Mappers::DeviceMapper
- Defined in:
- lib/s2d/mappers/device_mapper.rb
Class Method Summary collapse
Class Method Details
.to_hash(device) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/s2d/mappers/device_mapper.rb', line 5 def to_hash(device) {}.tap do |h| h[:name] = device.name h[:transport] = TransportMapper.to_hash(device.transport) end end |
.to_object(h) ⇒ Object
12 13 14 15 16 |
# File 'lib/s2d/mappers/device_mapper.rb', line 12 def to_object(h) Device.new(h[:name]).tap do |d| d.transport = TransportMapper.to_object(h[:transport]) end end |