Class: Themis::Validation::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/themis/validation/validator.rb

Overview

Simple structure to store information about methods called on validation module. It saves name and arguments of validation method in order to apply it on model later.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, args) ⇒ Validator

Returns a new instance of Validator.

Parameters:

  • name (Symbol, String)

    validation method name, e.g. “validates_presence_of”

  • args (Array)

    arguments of method



12
13
14
# File 'lib/themis/validation/validator.rb', line 12

def initialize(name, args)
  @name, @args = name, args
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



8
9
10
# File 'lib/themis/validation/validator.rb', line 8

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/themis/validation/validator.rb', line 8

def name
  @name
end