lib/active_model/serializer/adapter.rb in cheap_ams-0.10.5 vs lib/active_model/serializer/adapter.rb in cheap_ams-0.10.6
- old
+ new
@@ -13,11 +13,11 @@
klass = override ? adapter_class(override) : ActiveModel::Serializer.adapter
klass.new(resource, options)
end
def self.adapter_class(adapter)
- adapter_name = adapter.to_s.classify.sub("API", "Api")
+ adapter_name = adapter.to_s.classify.sub('API', 'Api')
"ActiveModel::Serializer::Adapter::#{adapter_name}".safe_constantize
end
attr_reader :serializer
@@ -66,24 +66,24 @@
def cache_key
parts = []
parts << object_cache_key
parts << @klass._cache_digest unless @klass._cache_options && @klass._cache_options[:skip_digest]
- parts.join("/")
+ parts.join('/')
end
def object_cache_key
object_time_safe = @cached_serializer.object.updated_at
- object_time_safe = object_time_safe.strftime("%Y%m%d%H%M%S%9N") if object_time_safe.respond_to?(:strftime)
+ object_time_safe = object_time_safe.strftime('%Y%m%d%H%M%S%9N') if object_time_safe.respond_to?(:strftime)
(@klass._cache_key) ? "#{@klass._cache_key}/#{@cached_serializer.object.id}-#{object_time_safe}" : @cached_serializer.object.cache_key
end
def meta
serializer.meta if serializer.respond_to?(:meta)
end
def meta_key
- serializer.meta_key || "meta"
+ serializer.meta_key || 'meta'
end
def root
serializer.json_key.to_sym if serializer.json_key
end