Module: Scorpio::OpenAPI::Reference

Included in:
V2::JsonReference, V3::Reference
Defined in:
lib/scorpio/openapi/reference.rb

Instance Method Summary collapse

Instance Method Details

#[](token, *a, &b) ⇒ Object

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



9
10
11
12
13
14
15
16
# File 'lib/scorpio/openapi/reference.rb', line 9

def [](token, *a, &b)
  if respond_to?(:to_hash) && !key?(token)
    deref do |deref_jsi|
      return deref_jsi[token]
    end
  end
  return super
end