Class: Tram::Policy::Validator
- Inherits:
-
Object
- Object
- Tram::Policy::Validator
- Defined in:
- lib/tram/policy/validator.rb
Overview
Describes a validator
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scope ⇒ Object
readonly
Returns the value of attribute scope.
-
#stop_on_failure ⇒ Object
readonly
Returns the value of attribute stop_on_failure.
Instance Method Summary collapse
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
4 5 6 |
# File 'lib/tram/policy/validator.rb', line 4 def block @block end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/tram/policy/validator.rb', line 4 def name @name end |
#scope ⇒ Object (readonly)
Returns the value of attribute scope.
4 5 6 |
# File 'lib/tram/policy/validator.rb', line 4 def scope @scope end |
#stop_on_failure ⇒ Object (readonly)
Returns the value of attribute stop_on_failure.
4 5 6 |
# File 'lib/tram/policy/validator.rb', line 4 def stop_on_failure @stop_on_failure end |
Instance Method Details
#==(other) ⇒ Object
6 7 8 |
# File 'lib/tram/policy/validator.rb', line 6 def ==(other) other.is_a?(self.class) && name && other.name == name end |
#check(object) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/tram/policy/validator.rb', line 10 def check(object) object.__send__ :instance_variable_set, :@__scope__, scope name ? object.__send__(name) : object.instance_exec(&block) rescue object.__send__ :instance_variable_set, :@__scope__, nil end |