Merge pull request #1183 from rails-api/block_style

Update Rubocop todo
This commit is contained in:
L. Preston Sego III
2015-09-21 01:25:50 -05:00
7 changed files with 32 additions and 90 deletions

View File

@@ -58,12 +58,12 @@ module ActiveModel
return adapter if adapter.is_a?(Class)
adapter_name = adapter.to_s.underscore
# 2. return if registered
adapter_map.fetch(adapter_name) {
adapter_map.fetch(adapter_name) do
# 3. try to find adapter class from environment
adapter_class = find_by_name(adapter_name)
register(adapter_name, adapter_class)
adapter_class
}
end
rescue NameError, ArgumentError => e
failure_message =
"NameError: #{e.message}. Unknown adapter: #{adapter.inspect}. Valid adapters are: #{adapters}"

View File

@@ -11,9 +11,9 @@ module ActiveModel
@root = options[:root]
@object = resources
@serializers = resources.map do |resource|
serializer_class = options.fetch(:serializer) {
serializer_class = options.fetch(:serializer) do
ActiveModel::Serializer.serializer_for(resource)
}
end
if serializer_class.nil?
fail NoSerializerError, "No serializer found for resource: #{resource.inspect}"

View File

@@ -16,9 +16,9 @@ module ActiveModel
when Symbol
{ included => {} }
when Hash
included.each_with_object({}) { |(key, value), hash|
included.each_with_object({}) do |(key, value), hash|
hash[key] = include_args_to_hash(value)
}
end
when Array
included.reduce({}) { |a, e| a.merge!(include_args_to_hash(e)) }
when String