Remove 'Adapter' suffix from adapters since they are in Adapter:: namespace

This commit is contained in:
Tema Bolshakov
2014-08-29 11:40:56 +04:00
parent 6bb4501f67
commit e45e5a82b7
10 changed files with 17 additions and 17 deletions

View File

@@ -77,7 +77,7 @@ module ActiveModel
def self.adapter
adapter_class = case config.adapter
when Symbol
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}Adapter"
class_name = "ActiveModel::Serializer::Adapter::#{config.adapter.to_s.classify}"
if Object.const_defined?(class_name)
Object.const_get(class_name)
end

View File

@@ -2,9 +2,9 @@ module ActiveModel
class Serializer
class Adapter
extend ActiveSupport::Autoload
autoload :JsonAdapter
autoload :NullAdapter
autoload :JsonApiAdapter
autoload :Json
autoload :Null
autoload :JsonApi
attr_reader :serializer

View File

@@ -1,7 +1,7 @@
module ActiveModel
class Serializer
class Adapter
class JsonAdapter < Adapter
class Json < Adapter
def serializable_hash(options = {})
serializer.attributes.each_with_object({}) do |(attr, value), h|
h[attr] = value

View File

@@ -1,7 +1,7 @@
module ActiveModel
class Serializer
class Adapter
class JsonApiAdapter < Adapter
class JsonApi < Adapter
def serializable_hash(options = {})
@hash = serializer.attributes

View File

@@ -1,7 +1,7 @@
module ActiveModel
class Serializer
class Adapter
class NullAdapter < Adapter
class Null < Adapter
def serializable_hash(options = {})
{}
end