active_model_serializers/lib/active_model/serializer/adapter.rb
2014-11-03 17:38:58 -05:00

25 lines
542 B
Ruby

module ActiveModel
class Serializer
class Adapter
extend ActiveSupport::Autoload
autoload :Json
autoload :Null
autoload :JsonApi
attr_reader :serializer
def initialize(serializer, options = {})
@serializer = serializer
end
def serializable_hash(options = {})
raise NotImplementedError, 'This is an abstract method. Should be implemented at the concrete adapter.'
end
def as_json(options = {})
serializable_hash(options)
end
end
end
end