module Riak::Serializers

Constants

YAML_MIME_TYPES

Public Instance Methods

[](content_type) click to toggle source
# File lib/riak/serializers.rb, line 6
def [](content_type)
  serializers[content_type]
end
[]=(content_type, serializer) click to toggle source
# File lib/riak/serializers.rb, line 10
def []=(content_type, serializer)
  serializers[content_type] = serializer
end
deserialize(content_type, content) click to toggle source
# File lib/riak/serializers.rb, line 18
def deserialize(content_type, content)
  serializer_for(content_type).load(content)
end
serialize(content_type, content) click to toggle source
# File lib/riak/serializers.rb, line 14
def serialize(content_type, content)
  serializer_for(content_type).dump(content)
end

Private Instance Methods

serializer_for(content_type) click to toggle source
# File lib/riak/serializers.rb, line 24
def serializer_for(content_type)
  serializers.fetch(content_type[/^[^;\s]+/]) do
    raise IOError.new(t('serializer_not_implemented', :content_type => content_type.inspect))
  end
end
serializers() click to toggle source
# File lib/riak/serializers.rb, line 30
def serializers
  @serializers ||= {}
end