Class: S2D::Mappers::TransportMapper

Inherits:
Object
  • Object
show all
Defined in:
lib/s2d/mappers/transport_mapper.rb

Class Method Summary collapse

Class Method Details

.to_hash(transport) ⇒ Object



5
6
7
8
9
10
# File 'lib/s2d/mappers/transport_mapper.rb', line 5

def to_hash(transport)
  {}.tap do |h|
    h[:name]   = transport.class
    h[:config] = transport.config
  end
end

.to_object(h) ⇒ Object



12
13
14
# File 'lib/s2d/mappers/transport_mapper.rb', line 12

def to_object(h)
  h[:name].new(h[:config])
end