Module: Scorpio::OpenAPI::Reference::Derefable

Defined in:
lib/scorpio/openapi/reference.rb

Overview

Derefable is included on the schema module of any schema that describes a reference or has an in-place applicator that describes a reference. You can call #deref regardless whether an object is of an expected type, or a reference to one, or a reference to a reference to one.

Instance Method Summary collapse

Instance Method Details

#derefObject

resolves references (Scorpio::OpenAPI::Reference#resolve) recursively.



67
68
69
70
71
72
# File 'lib/scorpio/openapi/reference.rb', line 67

def deref
  return self unless is_a?(Reference) && has_ref?
  resolved = resolve
  return resolved if !resolved.is_a?(Reference)
  resolved.deref
end