Class: Lurker::RefObject
- Inherits:
-
Object
- Object
- Lurker::RefObject
- Defined in:
- lib/lurker/ref_object.rb
Instance Method Summary collapse
- #abs_path ⇒ Object
-
#initialize(ref_path, root_path) ⇒ RefObject
constructor
A new instance of RefObject.
- #schema ⇒ Object
- #schema_descriptor ⇒ Object
Constructor Details
#initialize(ref_path, root_path) ⇒ RefObject
Returns a new instance of RefObject.
2 3 4 5 |
# File 'lib/lurker/ref_object.rb', line 2 def initialize(ref_path, root_path) @ref_path = ref_path @root_path = root_path end |
Instance Method Details
#abs_path ⇒ Object
19 20 21 |
# File 'lib/lurker/ref_object.rb', line 19 def abs_path @abs_path ||= @root_path.merge(URI.parse(@ref_path)).tap { |u| u.fragment = nil } end |
#schema ⇒ Object
7 8 9 10 11 |
# File 'lib/lurker/ref_object.rb', line 7 def schema return @ref_schema if @ref_schema return {} if @ref_path.nil? || @root_path.nil? @ref_schema = JSON.parse(schema_descriptor.read) end |
#schema_descriptor ⇒ Object
13 14 15 16 17 |
# File 'lib/lurker/ref_object.rb', line 13 def schema_descriptor open(abs_path.to_s) rescue Errno::ENOENT Lurker::JamlDescriptor.new(abs_path.to_s) end |