Class: Rule::Base
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #add_error(error) ⇒ Object
-
#initialize(object) ⇒ Base
constructor
A new instance of Base.
- #pass? ⇒ Boolean
Methods included from Assertions
#assert, #assert_absence_of, #assert_presence_of
Constructor Details
#initialize(object) ⇒ Base
Returns a new instance of Base.
5 6 7 8 |
# File 'lib/rule/base.rb', line 5 def initialize(object) @object = object @errors = [] end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
4 5 6 |
# File 'lib/rule/base.rb', line 4 def object @object end |
Instance Method Details
#add_error(error) ⇒ Object
10 11 12 |
# File 'lib/rule/base.rb', line 10 def add_error(error) @errors << error end |
#pass? ⇒ Boolean
14 15 16 |
# File 'lib/rule/base.rb', line 14 def pass? validate != false and @errors.none? end |