Sha256: 3097975aff5a76ce462cf2ed142f03858f74cd3f4db6bcaae85e45417424f54a

Contents?: true

Size: 375 Bytes

Versions: 2

Compression:

Stored size: 375 Bytes

Contents

require 'set'

module SimpleValidate
  class ValidatesSetBase < ValidatesBase
    attr_accessor :set, :options

    def initialize(attribute, options)
      self.options = options
      self.set = Set.new(Array(options[:in]).map(&:to_s))
      super(attribute, options[:message] ||
        'breaks inclusion/exclusion rules', options[:if] || proc { true })
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simple_validate-1.2.2 lib/simple_validate/validates_set_base.rb
simple_validate-1.1.2 lib/simple_validate/validates_set_base.rb