Sha256: 8c57d64fee2a6b3c541884634e7935371f6fcb5ae6e85388f528b7cd8b991bac
Contents?: true
Size: 710 Bytes
Versions: 43
Compression:
Stored size: 710 Bytes
Contents
# 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 end end end
Version data entries
43 entries across 41 versions & 6 rubygems