Module: Rekiq::Validator::ClassMethods

Defined in:
lib/rekiq/validator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#for_validationObject

Returns the value of attribute for_validation.



6
7
8
# File 'lib/rekiq/validator.rb', line 6

def for_validation
  @for_validation
end

Instance Method Details

#validate(attribute_name, type, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/rekiq/validator.rb', line 8

def validate(attribute_name, type, options = {})
  options[:allow_nil] = false if options[:allow_nil].nil?

  self.for_validation << {
      attribute_name: attribute_name,
      type:           type,
      options:        options
    }
end