Class: JSONSchemer::Schema::Context

Inherits:
Struct
  • Object
show all
Defined in:
lib/json_schemer/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_modeObject

Returns the value of attribute access_mode

Returns:

  • (Object)

    the current value of access_mode



4
5
6
# File 'lib/json_schemer/schema.rb', line 4

def access_mode
  @access_mode
end

#adjacent_resultsObject

Returns the value of attribute adjacent_results

Returns:

  • (Object)

    the current value of adjacent_results



4
5
6
# File 'lib/json_schemer/schema.rb', line 4

def adjacent_results
  @adjacent_results
end

#dynamic_scopeObject

Returns the value of attribute dynamic_scope

Returns:

  • (Object)

    the current value of dynamic_scope



4
5
6
# File 'lib/json_schemer/schema.rb', line 4

def dynamic_scope
  @dynamic_scope
end

#instanceObject

Returns the value of attribute instance

Returns:

  • (Object)

    the current value of instance



4
5
6
# File 'lib/json_schemer/schema.rb', line 4

def instance
  @instance
end

#short_circuitObject

Returns the value of attribute short_circuit

Returns:

  • (Object)

    the current value of short_circuit



4
5
6
# File 'lib/json_schemer/schema.rb', line 4

def short_circuit
  @short_circuit
end

Instance Method Details

#original_instance(instance_location) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/json_schemer/schema.rb', line 5

def original_instance(instance_location)
  Hana::Pointer.parse(Location.resolve(instance_location)).reduce(instance) do |obj, token|
    if obj.is_a?(Array)
      obj.fetch(token.to_i)
    elsif !obj.key?(token) && obj.key?(token.to_sym)
      obj.fetch(token.to_sym)
    else
      obj.fetch(token)
    end
  end
end