Convert \r\n to \n

This commit is contained in:
Ryuta Kamizono 2021-04-24 14:10:18 +09:00
parent 8a23c85f6e
commit a1afc7726b
1 changed files with 38 additions and 38 deletions

View File

@ -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