Class: JSchema::SchemaRef

Inherits:
Delegator
  • Object
show all
Defined in:
lib/jschema/schema_ref.rb

Overview

Schema reference is lazy evaluated.

Instance Method Summary collapse

Constructor Details

#initialize(uri, parent) ⇒ SchemaRef

Returns a new instance of SchemaRef.



4
5
6
7
# File 'lib/jschema/schema_ref.rb', line 4

def initialize(uri, parent)
  @uri = uri
  @parent = parent
end

Instance Method Details

#__getobj__Object



9
10
11
12
13
14
# File 'lib/jschema/schema_ref.rb', line 9

def __getobj__
  @schema ||= begin
    JSONReference.dereference(@uri, @parent) ||
      Kernel.fail(InvalidSchema, "Failed to dereference schema: #{@uri}")
  end
end