123456789_123456789_123456789_123456789_123456789_

Module: ActiveModel::Validations::ResolveValue

Do not use. This module is for internal use only.

Instance Method Summary

Instance Method Details

#resolve_value(record, value)

[ GitHub ]

  
# File 'activemodel/lib/active_model/validations/resolve_value.rb', line 6

def resolve_value(record, value)
  case value
  when Proc
    if value.arity == 0
      value.call
    else
      value.call(record)
    end
  when Symbol
    record.send(value)
  else
    if value.respond_to?(:call)
      value.call(record)
    else
      value
    end
  end
end