Class: Gearhead::Serializers::Lookup

Inherits:
Object
  • Object
show all
Defined in:
lib/gearhead/serializers/lookup.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, adapter_name) ⇒ Lookup

Returns a new instance of Lookup.



9
10
11
12
# File 'lib/gearhead/serializers/lookup.rb', line 9

def initialize(type, adapter_name)
  @type = type.to_s
  @adapter_name = adapter_name
end

Instance Attribute Details

#adapter_nameObject (readonly)

Returns the value of attribute adapter_name.



8
9
10
# File 'lib/gearhead/serializers/lookup.rb', line 8

def adapter_name
  @adapter_name
end

Class Method Details

.for(type, adapter_name = ::Gearhead.config.serialization.adapter) ⇒ Object



4
5
6
# File 'lib/gearhead/serializers/lookup.rb', line 4

def self.for(type, adapter_name = ::Gearhead.config.serialization.adapter)
  new(type, adapter_name).serializer
end

Instance Method Details

#serializerObject



14
15
16
# File 'lib/gearhead/serializers/lookup.rb', line 14

def serializer
  "::Gearhead::Serializers::#{adapter}::#{@type.classify}Serializer".constantize
end