Sha256: 0cdd26f6be2085fcf67c692626ebf5121d7670cf4e7f8666abb5836bc7ce6ba1

Contents?: true

Size: 400 Bytes

Versions: 24

Compression:

Stored size: 400 Bytes

Contents

require 'haveapi/client/validator'

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

24 entries across 24 versions & 1 rubygems

Version Path
haveapi-client-0.20.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.19.3 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.19.2 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.19.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.19.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.18.2 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.18.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.18.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.17.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.16.3 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.16.2 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.16.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.16.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.15.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.15.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.14.2 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.14.1 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.14.0 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.13.3 lib/haveapi/client/validators/confirmation.rb
haveapi-client-0.13.2 lib/haveapi/client/validators/confirmation.rb