Sha256: f4a771e70eab2956bbd326a1c548d6f206a167b4961f535731abb7dded79f23c

Contents?: true

Size: 272 Bytes

Versions: 5

Compression:

Stored size: 272 Bytes

Contents

# frozen_string_literal: true

module SimpleValidate
  class ValidatesExclusionOf < ValidatesSetBase
    def valid?(instance)
      raise ArgumentError if set.empty? || !options.fetch(:in).is_a?(Array)

      !set.include?(instance.send(attribute).to_s)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_validate-2.1.2 lib/simple_validate/validates_exclusion_of.rb
simple_validate-2.0.2 lib/simple_validate/validates_exclusion_of.rb
simple_validate-2.0.1 lib/simple_validate/validates_exclusion_of.rb
simple_validate-2.0.0 lib/simple_validate/validates_exclusion_of.rb
simple_validate-1.2.3 lib/simple_validate/validates_exclusion_of.rb