Sha256: 64a04b0ac7241f8a5a6832e47764c97f78a4279fdd97e25c8500ed4bd08b8dbc

Contents?: true

Size: 293 Bytes

Versions: 38

Compression:

Stored size: 293 Bytes

Contents

require 'haveapi/client/validator'

module HaveAPI::Client
  class Validators::Inclusion < Validator
    name :include

    def valid?
      if opts[:values].is_a?(::Hash)
        opts[:values].keys.include?(value)

      else
        opts[:values].include?(value)
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
haveapi-client-0.25.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.24.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.7 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.6 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.5 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.4 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.3 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.2 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.1 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.23.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.22.1 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.22.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.21.1 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.21.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.20.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.19.3 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.19.2 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.19.1 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.19.0 lib/haveapi/client/validators/inclusion.rb
haveapi-client-0.18.2 lib/haveapi/client/validators/inclusion.rb