mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Convert \r\n to \n
This commit is contained in:
parent
8a23c85f6e
commit
a1afc7726b
1 changed files with 38 additions and 38 deletions
|
@ -1,38 +1,38 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module ActiveModel
|
||||
module Validations
|
||||
module Comparability #:nodoc:
|
||||
COMPARE_CHECKS = { greater_than: :>, greater_than_or_equal_to: :>=,
|
||||
equal_to: :==, less_than: :<, less_than_or_equal_to: :<=,
|
||||
other_than: :!= }.freeze
|
||||
|
||||
def option_value(record, option_value)
|
||||
case option_value
|
||||
when Proc
|
||||
option_value.call(record)
|
||||
when Symbol
|
||||
record.send(option_value)
|
||||
else
|
||||
option_value
|
||||
end
|
||||
end
|
||||
|
||||
def error_options(value, option_value)
|
||||
options.except(*COMPARE_CHECKS.keys).merge!(
|
||||
count: option_value,
|
||||
value: value
|
||||
)
|
||||
end
|
||||
|
||||
def error_value(record, option_value)
|
||||
case option_value
|
||||
when Proc
|
||||
option_value(record, option_value)
|
||||
else
|
||||
option_value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
# frozen_string_literal: true
|
||||
|
||||
module ActiveModel
|
||||
module Validations
|
||||
module Comparability #:nodoc:
|
||||
COMPARE_CHECKS = { greater_than: :>, greater_than_or_equal_to: :>=,
|
||||
equal_to: :==, less_than: :<, less_than_or_equal_to: :<=,
|
||||
other_than: :!= }.freeze
|
||||
|
||||
def option_value(record, option_value)
|
||||
case option_value
|
||||
when Proc
|
||||
option_value.call(record)
|
||||
when Symbol
|
||||
record.send(option_value)
|
||||
else
|
||||
option_value
|
||||
end
|
||||
end
|
||||
|
||||
def error_options(value, option_value)
|
||||
options.except(*COMPARE_CHECKS.keys).merge!(
|
||||
count: option_value,
|
||||
value: value
|
||||
)
|
||||
end
|
||||
|
||||
def error_value(record, option_value)
|
||||
case option_value
|
||||
when Proc
|
||||
option_value(record, option_value)
|
||||
else
|
||||
option_value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue