Class: JsonMatchers::Matcher
- Inherits:
-
Object
- Object
- JsonMatchers::Matcher
- Defined in:
- lib/json_matchers/matcher.rb
Instance Method Summary collapse
-
#initialize(schema_path) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(payload) ⇒ Boolean
- #validation_failure_message ⇒ Object
Constructor Details
#initialize(schema_path) ⇒ Matcher
Returns a new instance of Matcher.
7 8 9 10 |
# File 'lib/json_matchers/matcher.rb', line 7 def initialize(schema_path) @schema_path = schema_path @document_store = build_and_populate_document_store end |
Instance Method Details
#matches?(payload) ⇒ Boolean
12 13 14 15 16 |
# File 'lib/json_matchers/matcher.rb', line 12 def matches?(payload) self.errors = validator.validate(payload) errors.empty? end |
#validation_failure_message ⇒ Object
18 19 20 |
# File 'lib/json_matchers/matcher.rb', line 18 def errors.first.to_s end |