Method: JSONSchemer::Schema::Context#original_instance
- Defined in:
- lib/json_schemer/schema.rb
#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 |