mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
24 lines
519 B
Ruby
24 lines
519 B
Ruby
module ActiveModel
|
|
class Serializer
|
|
class Adapter
|
|
extend ActiveSupport::Autoload
|
|
autoload :SimpleAdapter
|
|
autoload :NullAdapter
|
|
|
|
attr_reader :serializer
|
|
|
|
def initialize(serializer)
|
|
@serializer = serializer
|
|
end
|
|
|
|
def serializable_hash(options = {})
|
|
raise NotImplementedError, 'This is abstract method. Should be implemented at concrete adapter.'
|
|
end
|
|
|
|
def to_json(options={})
|
|
serializable_hash(options).to_json
|
|
end
|
|
end
|
|
end
|
|
end
|