Class: EasyJSONMatcher::Node
- Inherits:
-
Object
- Object
- EasyJSONMatcher::Node
- Defined in:
- lib/easy_json_matcher/node.rb
Instance Attribute Summary collapse
-
#node_validator ⇒ Object
readonly
Returns the value of attribute node_validator.
-
#validators ⇒ Object
readonly
Returns the value of attribute validators.
Instance Method Summary collapse
- #check(value:) ⇒ Object
-
#initialize(opts: [], strict: false, validators:, content_handler: ValidatorSet, factory: ValidationChainFactory) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(opts: [], strict: false, validators:, content_handler: ValidatorSet, factory: ValidationChainFactory) ⇒ Node
Returns a new instance of Node.
8 9 10 11 12 |
# File 'lib/easy_json_matcher/node.rb', line 8 def initialize(opts: [], strict: false, validators:, content_handler: ValidatorSet, factory: ValidationChainFactory) @node_validator = factory.get_chain(steps: opts + [:object]) @validators = content_handler.new(validators: validators, strict: strict) @node_validator.concat(@validators) end |
Instance Attribute Details
#node_validator ⇒ Object (readonly)
Returns the value of attribute node_validator.
6 7 8 |
# File 'lib/easy_json_matcher/node.rb', line 6 def node_validator @node_validator end |
#validators ⇒ Object (readonly)
Returns the value of attribute validators.
6 7 8 |
# File 'lib/easy_json_matcher/node.rb', line 6 def validators @validators end |
Instance Method Details
#check(value:) ⇒ Object
14 15 16 |
# File 'lib/easy_json_matcher/node.rb', line 14 def check(value:) node_validator.check(value: value) end |