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

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/activemodel-7.0.8.7/lib/active_model/validations/comparability.rb
activemodel-7.0.8.7 lib/active_model/validations/comparability.rb
activemodel-7.0.8.6 lib/active_model/validations/comparability.rb
activemodel-7.0.8.5 lib/active_model/validations/comparability.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/activemodel-7.0.8.4/lib/active_model/validations/comparability.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/activemodel-7.0.5.1/lib/active_model/validations/comparability.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/activemodel-7.0.5.1/lib/active_model/validations/comparability.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/activemodel-7.0.5.1/lib/active_model/validations/comparability.rb
activemodel-7.0.8.4 lib/active_model/validations/comparability.rb
activemodel-7.0.8.1 lib/active_model/validations/comparability.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activemodel-7.0.3.1/lib/active_model/validations/comparability.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/activemodel-7.0.2.3/lib/active_model/validations/comparability.rb
activemodel-7.0.8 lib/active_model/validations/comparability.rb
activemodel-7.0.7.2 lib/active_model/validations/comparability.rb
activemodel-7.0.7.1 lib/active_model/validations/comparability.rb
activemodel-7.0.7 lib/active_model/validations/comparability.rb
activemodel-7.0.6 lib/active_model/validations/comparability.rb
activemodel-7.0.5.1 lib/active_model/validations/comparability.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activemodel-7.0.2.3/lib/active_model/validations/comparability.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/activemodel-7.0.3.1/lib/active_model/validations/comparability.rb