Class: ObjectValidator::Checks::Base

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

Direct Known Subclasses

GreaterThan, Keys, Presence, Type, With

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, errors, name, value) ⇒ Base

Returns a new instance of Base.



54
55
56
57
58
59
# File 'lib/object_validator/validator.rb', line 54

def initialize(object, errors, name, value)
  @object = object
  @errors = errors
  @name = name
  @value = value
end

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



52
53
54
# File 'lib/object_validator/validator.rb', line 52

def errors
  @errors
end

#nameObject

Returns the value of attribute name.



52
53
54
# File 'lib/object_validator/validator.rb', line 52

def name
  @name
end

#objectObject

Returns the value of attribute object.



52
53
54
# File 'lib/object_validator/validator.rb', line 52

def object
  @object
end

#valueObject

Returns the value of attribute value.



52
53
54
# File 'lib/object_validator/validator.rb', line 52

def value
  @value
end

Instance Method Details

#methodObject



61
62
63
# File 'lib/object_validator/validator.rb', line 61

def method
  @method ||= @object.send(@name)
end