Module: JSI::PathedNode

Included in:
Base, JSON::Node, MetaschemaNode
Defined in:
lib/jsi/pathed_node.rb

Overview

including class MUST define

  • #node_document [Object] returning the document
  • #node_ptr [JSI::JSON::Pointer] returning a pointer for the node path in the document
  • #document_root_node [JSI::PathedNode] returning a PathedNode pointing at the document root
  • #parent_node [JSI::PathedNode] returning the parent node of this PathedNode
  • #deref [JSI::PathedNode] following a $ref

given these, this module represents the node in the document at the path.

the node content (#node_content) is the result of evaluating the node document at the path.

Instance Method Summary collapse

Instance Method Details

#node_contentObject

Returns the content of this node.

Returns:

  • (Object)

    the content of this node



16
17
18
19
# File 'lib/jsi/pathed_node.rb', line 16

def node_content
  content = node_ptr.evaluate(node_document)
  content
end

#node_ptr_deref {|JSI::JSON::Pointer| ... } ⇒ JSI::JSON::Pointer

Returns our node_ptr, derefed against our node_document.

Yields:

  • (JSI::JSON::Pointer)

    if a block is given (optional), this will yield a deref'd pointer

Returns:



23
24
25
# File 'lib/jsi/pathed_node.rb', line 23

def node_ptr_deref(&block)
  node_ptr.deref(node_document, &block)
end