Sha256: 26f8997ede1479dbc8f91404dc412b6c9c3e9115ac4bbda85445aeb88723d8b9

Contents?: true

Size: 583 Bytes

Versions: 2

Compression:

Stored size: 583 Bytes

Contents

module Scorpio
  module OpenAPI
    module Reference
      # overrides JSI::Base#[] to implicitly dereference this Reference, except when
      # the given token is present in this Reference's instance (this should usually
      # only apply to the token '$ref')
      #
      # see JSI::Base#initialize documentation at https://www.rubydoc.info/gems/jsi/JSI/Base
      def [](token, *a, &b)
        if respond_to?(:to_hash) && !key?(token)
          deref do |deref_jsi|
            return deref_jsi[token]
          end
        end
        return super
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scorpio-0.5.0 lib/scorpio/openapi/reference.rb
scorpio-0.4.6 lib/scorpio/openapi/reference.rb