Class: EasyJSONMatcher::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/easy_json_matcher/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_validatorObject (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

#validatorsObject (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