Class: SchemaGraphy::CFGYML::PathReference

Inherits:
Object
  • Object
show all
Defined in:
lib/schemagraphy/cfgyml/path_reference.rb

Overview

Loads and queries a JSON config reference using JSON Pointer.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ PathReference

Returns a new instance of PathReference.


9
10
11
# File 'lib/schemagraphy/cfgyml/path_reference.rb', line 9

def initialize data
  @data = data
end

Class Method Details

.load(path) ⇒ Object



13
14
15
# File 'lib/schemagraphy/cfgyml/path_reference.rb', line 13

def self.load path
  new(JSON.parse(File.read(path)))
end

Instance Method Details

#get(pointer) ⇒ Object



17
18
19
# File 'lib/schemagraphy/cfgyml/path_reference.rb', line 17

def get pointer
  SchemaGraphy::DataQuery::JSONPointer.resolve(@data, pointer)
end