Class: Xpect::Spect
- Inherits:
-
Object
- Object
- Xpect::Spect
- Defined in:
- lib/xpect/spect.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#conform!(spec:, data:, path: []) ⇒ Object
1) Raise exception if spec isn’t satisfied 2) Return data as it adheres to the spec.
-
#validate!(spec:, data:) ⇒ Object
1) Raise exception if spec isn’t satisfied 2) Return original data.
Class Method Details
.conform!(spec:, data:, path: []) ⇒ Object
3 4 5 |
# File 'lib/xpect/spect.rb', line 3 def self.conform!(spec:, data:, path: []) new.conform!(spec: spec, data: data, path: path) end |
.validate!(spec:, data:) ⇒ Object
7 8 9 |
# File 'lib/xpect/spect.rb', line 7 def self.validate!(spec:, data:) new.validate!(spec: spec, data: data) end |
Instance Method Details
#conform!(spec:, data:, path: []) ⇒ Object
1) Raise exception if spec isn’t satisfied 2) Return data as it adheres to the spec
19 20 21 |
# File 'lib/xpect/spect.rb', line 19 def conform!(spec:, data:, path: []) call(spec: spec, data: data, path: path) end |
#validate!(spec:, data:) ⇒ Object
1) Raise exception if spec isn’t satisfied 2) Return original data
13 14 15 |
# File 'lib/xpect/spect.rb', line 13 def validate!(spec:, data:) call(spec: spec, data: data, init: data) end |