Class: OpenApi::Reference

Inherits:
Object
  • Object
show all
Includes:
EquatableAsContent
Defined in:
lib/open_api/reference.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EquatableAsContent

#==

Constructor Details

#initialize(ref:) ⇒ Reference

Returns a new instance of Reference.



8
9
10
# File 'lib/open_api/reference.rb', line 8

def initialize(ref:)
  self.ref = ref
end

Instance Attribute Details

#refObject

Returns the value of attribute ref.



6
7
8
# File 'lib/open_api/reference.rb', line 6

def ref
  @ref
end

Class Method Details

.load(hash) ⇒ Object



18
19
20
21
22
23
# File 'lib/open_api/reference.rb', line 18

def self.load(hash)
  return unless hash
  return unless hash["$ref"]

  new(ref: hash["$ref"])
end

Instance Method Details

#serializable_hashObject



12
13
14
15
16
# File 'lib/open_api/reference.rb', line 12

def serializable_hash
  {
    "$ref" => ref.to_s,
  }
end