Sha256: 2c2d12f84f4bab4f64f6c151c528854f740dc1f50105bcb8a8489d7d36f621e3

Contents?: true

Size: 271 Bytes

Versions: 5

Compression:

Stored size: 271 Bytes

Contents

# frozen_string_literal: true

module SimpleValidate
  class ValidatesInclusionOf < 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_inclusion_of.rb
simple_validate-2.0.2 lib/simple_validate/validates_inclusion_of.rb
simple_validate-2.0.1 lib/simple_validate/validates_inclusion_of.rb
simple_validate-2.0.0 lib/simple_validate/validates_inclusion_of.rb
simple_validate-1.2.3 lib/simple_validate/validates_inclusion_of.rb