Class: Validatable::ChildValidation

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attribute, map, should_validate_proc) ⇒ ChildValidation

Returns a new instance of ChildValidation.



5
6
7
8
9
# File 'lib/child_validation.rb', line 5

def initialize(attribute, map, should_validate_proc)
  @attribute = attribute
  @map = map
  @should_validate_proc = should_validate_proc
end

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute.



3
4
5
# File 'lib/child_validation.rb', line 3

def attribute
  @attribute
end

#mapObject

Returns the value of attribute map.



3
4
5
# File 'lib/child_validation.rb', line 3

def map
  @map
end

#should_validate_procObject

Returns the value of attribute should_validate_proc.



3
4
5
# File 'lib/child_validation.rb', line 3

def should_validate_proc
  @should_validate_proc
end

Instance Method Details

#should_validate?(instance) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/child_validation.rb', line 11

def should_validate?(instance)
  instance.instance_eval &should_validate_proc
end