Sha256: b9b1c047f9611915a89958dcca523bcb057ea7ff377aa4aef9bbd76f29e31a96

Contents?: true

Size: 370 Bytes

Versions: 16

Compression:

Stored size: 370 Bytes

Contents

module HaveAPI::Client
  class Validators::Confirmation < Validator
    name :confirm

    def valid?
      other = opts[:parameter].to_sym
      
      if opts[:equal]
        return false if params[other].nil?
        value == params[other].value

      else
        other = params[other] ? params[other].value : nil
        value != other
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
haveapi-client-0.11.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.11.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.10.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.9.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.8.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.7.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.7.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.6.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.5.4 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.5.3 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.5.2 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.5.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.5.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.4.2 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.4.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.4.0 lib/haveapi/client/validators/confirmation.rb