Class: Settis::StringSerializer

Inherits:
Serializer show all
Defined in:
lib/settis/serializers/string.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Serializer

for, inherited, #initialize

Constructor Details

This class inherits a constructor from Settis::Serializer

Class Method Details

.serializes?(type) ⇒ Boolean

Returns:

  • (Boolean)


19
20
21
22
23
24
# File 'lib/settis/serializers/string.rb', line 19

def self.serializes?(type)
  case type
  when :string, 'string' then true
  when Class then type == String or type.ancestors.include?(String)
  end
end

Instance Method Details

#deserialize(value) ⇒ Object



30
31
32
# File 'lib/settis/serializers/string.rb', line 30

def deserialize(value)
  value.to_s unless value.nil?
end

#serialize(value) ⇒ Object



26
27
28
# File 'lib/settis/serializers/string.rb', line 26

def serialize(value)
  value.to_s unless value.nil?
end