Class: Definition::Types::Base
- Inherits:
-
Object
- Object
- Definition::Types::Base
- Defined in:
- lib/definition/types/base.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #conform(_value) ⇒ Object
- #explain(value) ⇒ Object
-
#initialize(name) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(name) ⇒ Base
Returns a new instance of Base.
11 12 13 |
# File 'lib/definition/types/base.rb', line 11 def initialize(name) self.name = name end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/definition/types/base.rb', line 9 def name @name end |
Instance Method Details
#conform(_value) ⇒ Object
22 23 24 |
# File 'lib/definition/types/base.rb', line 22 def conform(_value) raise NotImplementedError end |
#explain(value) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/definition/types/base.rb', line 15 def explain(value) result = conform(value) return "value passes definition" if result.passed? result. end |