Class: JSONSchemer::Schema::Context
- Inherits:
-
Struct
- Object
- Struct
- JSONSchemer::Schema::Context
- Defined in:
- lib/json_schemer/schema.rb
Instance Attribute Summary collapse
-
#access_mode ⇒ Object
Returns the value of attribute access_mode.
-
#adjacent_results ⇒ Object
Returns the value of attribute adjacent_results.
-
#dynamic_scope ⇒ Object
Returns the value of attribute dynamic_scope.
-
#instance ⇒ Object
Returns the value of attribute instance.
-
#short_circuit ⇒ Object
Returns the value of attribute short_circuit.
Instance Method Summary collapse
Instance Attribute Details
#access_mode ⇒ Object
Returns the value of attribute access_mode
4 5 6 |
# File 'lib/json_schemer/schema.rb', line 4 def access_mode @access_mode end |
#adjacent_results ⇒ Object
Returns the value of attribute adjacent_results
4 5 6 |
# File 'lib/json_schemer/schema.rb', line 4 def adjacent_results @adjacent_results end |
#dynamic_scope ⇒ Object
Returns the value of attribute dynamic_scope
4 5 6 |
# File 'lib/json_schemer/schema.rb', line 4 def dynamic_scope @dynamic_scope end |
#instance ⇒ Object
Returns the value of attribute instance
4 5 6 |
# File 'lib/json_schemer/schema.rb', line 4 def instance @instance end |
#short_circuit ⇒ Object
Returns the value of attribute 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 |