Class: Oval::Base
- Inherits:
-
Object
- Object
- Oval::Base
- Defined in:
- lib/oval/base.rb
Direct Known Subclasses
Anything, ArrayItem, ClassDeclBase, Collection, HashItem, Match, OneOf, Options
Class Method Summary collapse
-
.[](*args) ⇒ Object
,subject = default_subject).
- .ensure_equal(thing, decl, subject = nil) ⇒ Object
- .it_should(decl) ⇒ Object
- .validate(thing, decl, subject = nil) ⇒ Object
Instance Method Summary collapse
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #it_should ⇒ Object
- #validate(value, subject = nil) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
48 49 |
# File 'lib/oval/base.rb', line 48 def initialize(*args) end |
Class Method Details
.[](*args) ⇒ Object
,subject = default_subject)
36 37 38 |
# File 'lib/oval/base.rb', line 36 def self.[](*args)#,subject = default_subject) return new(*args) end |
.ensure_equal(thing, decl, subject = nil) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/oval/base.rb', line 8 def self.ensure_equal(thing, decl, subject = nil) unless (decl == Oval::Anything) or (thing == decl) raise Oval::ValueError, "Invalid value #{thing.inspect}#{for_subject(subject)}. Should be " + "equal #{decl.inspect}" end end |
Instance Method Details
#it_should ⇒ Object
44 45 46 |
# File 'lib/oval/base.rb', line 44 def it_should() raise NotImplementedError, "This method should be overwritten by a subclass" end |
#validate(value, subject = nil) ⇒ Object
40 41 42 |
# File 'lib/oval/base.rb', line 40 def validate(value, subject = nil) raise NotImplementedError, "This method should be overwritten by a subclass" end |