1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix Remaining Case-In-Assignment Statement Formatting

Recently, the Rails team made an effort to keep the source code consistent, using Ruboco
(bb1ecdcc67 and below). Some of the case
statements were missed.

This changes the case statements' formatting and is consistent with changes
in 810dff7c9f and db63406cb0.
This commit is contained in:
Alex Kitchens 2016-09-06 09:34:09 -05:00
parent 38fae35d53
commit fbccae4d19
10 changed files with 123 additions and 113 deletions

View file

@ -1026,7 +1026,8 @@ module ActionView
# prompt_option_tag(:month, prompt: 'Select month')
# => "<option value="">Select month</option>"
def prompt_option_tag(type, options)
prompt = case options
prompt = \
case options
when Hash
default_options = { year: false, month: false, day: false, hour: false, minute: false, second: false }
default_options.merge!(options)[type.to_sym]

View file

@ -857,7 +857,8 @@ module ActionView
authenticity_token = html_options.delete("authenticity_token")
method = html_options.delete("method").to_s.downcase
method_tag = case method
method_tag = \
case method
when "get"
html_options["method"] = "get"
""

View file

@ -16,7 +16,8 @@ module ActiveModel
private
def cast_value(value)
casted_value = case value
casted_value = \
case value
when ::Float
convert_float_to_big_decimal(value)
when ::Numeric, ::String

View file

@ -570,7 +570,8 @@ module ActiveRecord
# Maps logical Rails types to MySQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil, unsigned = nil)
sql = case type.to_s
sql = \
case type.to_s
when "integer"
integer_to_sql(limit)
when "text"

View file

@ -625,7 +625,8 @@ module ActiveRecord
# Maps logical Rails types to PostgreSQL-specific data types.
def type_to_sql(type, limit = nil, precision = nil, scale = nil, array = nil)
sql = case type.to_s
sql = \
case type.to_s
when "binary"
# PostgreSQL doesn't support limits on binary (bytea) columns.
# The hard limit is 1GB, because of a 32-bit size field, and TOAST.

View file

@ -519,7 +519,8 @@ module ActiveRecord
# larger than the limit.
def check_record_limit!(limit, attributes_collection)
if limit
limit = case limit
limit = \
case limit
when Symbol
send(limit)
when Proc

View file

@ -59,7 +59,8 @@ module ActiveRecord
FROZEN_EMPTY_HASH = {}.freeze
Relation::VALUE_METHODS.each do |name|
method_name = case name
method_name = \
case name
when *Relation::MULTI_VALUE_METHODS then "#{name}_values"
when *Relation::SINGLE_VALUE_METHODS then "#{name}_value"
when *Relation::CLAUSE_METHODS then "#{name}_clause"

View file

@ -46,7 +46,8 @@ module ActiveRecord
def structure_dump(filename)
set_psql_env
search_path = case ActiveRecord::Base.dump_schemas
search_path = \
case ActiveRecord::Base.dump_schemas
when :schema_search_path
configuration["schema_search_path"]
when :all

View file

@ -83,7 +83,8 @@ module I18n
def self.init_fallbacks(fallbacks)
include_fallbacks_module
args = case fallbacks
args = \
case fallbacks
when ActiveSupport::OrderedOptions
[*(fallbacks[:defaults] || []) << fallbacks[:map]].compact
when Hash, Array

View file

@ -162,7 +162,8 @@ module Rails
def set_default_accessors!
self.destination_root = File.expand_path(app_path, destination_root)
self.rails_template = case options[:template]
self.rails_template = \
case options[:template]
when /^https?:\/\//
options[:template]
when String