Style/StringLiterals single quote all the things

This commit is contained in:
Benjamin Fleischer
2015-08-30 23:20:25 -05:00
parent 09c97de90d
commit bdfe13c527
36 changed files with 347 additions and 347 deletions

View File

@@ -21,7 +21,7 @@ module ActionController
def get_serializer(resource, options = {})
if ! use_adapter?
warn "ActionController::Serialization#use_adapter? has been removed. "\
warn 'ActionController::Serialization#use_adapter? has been removed. '\
"Please pass 'adapter: false' or see ActiveSupport::SerializableResource#serialize"
options[:adapter] = false
end

View File

@@ -15,7 +15,7 @@ module ActiveModel
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
@@ -68,12 +68,12 @@ module ActiveModel
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
@@ -82,7 +82,7 @@ module ActiveModel
end
def meta_key
serializer.meta_key || "meta"
serializer.meta_key || 'meta'
end
def root

View File

@@ -23,7 +23,7 @@ module ActiveModel::Serializer::Lint
# <tt>serializable_hash</tt> returns a hash representation of a object's attributes.
# Typically, it is implemented by including ActiveModel::Serialization.
def test_serializable_hash
assert_respond_to resource, :serializable_hash, "The resource should respond to serializable_hash"
assert_respond_to resource, :serializable_hash, 'The resource should respond to serializable_hash'
resource.serializable_hash
resource.serializable_hash(nil)
end
@@ -35,7 +35,7 @@ module ActiveModel::Serializer::Lint
# <tt>read_attribute_for_serialization</tt> gets the attribute value for serialization
# Typically, it is implemented by including ActiveModel::Serialization.
def test_read_attribute_for_serialization
assert_respond_to resource, :read_attribute_for_serialization, "The resource should respond to read_attribute_for_serialization"
assert_respond_to resource, :read_attribute_for_serialization, 'The resource should respond to read_attribute_for_serialization'
actual_arity = resource.method(:read_attribute_for_serialization).arity
if defined?(::Rubinius)
# 1 for def read_attribute_for_serialization(name); end

View File

@@ -1,5 +1,5 @@
module ActiveModel
class Serializer
VERSION = "0.10.0.rc2"
VERSION = '0.10.0.rc2'
end
end

View File

@@ -1,12 +1,12 @@
module Rails
module Generators
class SerializerGenerator < NamedBase
source_root File.expand_path("../templates", __FILE__)
check_class_collision :suffix => "Serializer"
source_root File.expand_path('../templates', __FILE__)
check_class_collision :suffix => 'Serializer'
argument :attributes, :type => :array, :default => [], :banner => "field:type field:type"
argument :attributes, :type => :array, :default => [], :banner => 'field:type field:type'
class_option :parent, :type => :string, :desc => "The parent class for the generated serializer"
class_option :parent, :type => :string, :desc => 'The parent class for the generated serializer'
def create_serializer_file
template 'serializer.rb.erb', File.join('app/serializers', class_path, "#{file_name}_serializer.rb")
@@ -26,9 +26,9 @@ module Rails
if options[:parent]
options[:parent]
elsif defined?(::ApplicationSerializer)
"ApplicationSerializer"
'ApplicationSerializer'
else
"ActiveModel::Serializer"
'ActiveModel::Serializer'
end
end
end