Class: Argentinian::Validations::Base
- Inherits:
-
Object
- Object
- Argentinian::Validations::Base
- Defined in:
- lib/argentinian/validations/base.rb
Defined Under Namespace
Classes: LengthError, NotNumericError
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(value) ⇒ Base
constructor
A new instance of Base.
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(value) ⇒ Base
Returns a new instance of Base.
9 10 11 12 |
# File 'lib/argentinian/validations/base.rb', line 9 def initialize(value) @value = value.to_s @errors = [] end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
7 8 9 |
# File 'lib/argentinian/validations/base.rb', line 7 def errors @errors end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/argentinian/validations/base.rb', line 7 def value @value end |
Instance Method Details
#valid? ⇒ Boolean
14 15 16 |
# File 'lib/argentinian/validations/base.rb', line 14 def valid? raise 'Subclass must implement' end |
#validate! ⇒ Object
18 19 20 |
# File 'lib/argentinian/validations/base.rb', line 18 def validate! raise 'Subclass must implement' end |