Class: SwaggerYard::Swagger

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_yard/swagger.rb

Direct Known Subclasses

OpenAPI

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec = Specification.new) ⇒ Swagger

Returns a new instance of Swagger.



22
23
24
# File 'lib/swagger_yard/swagger.rb', line 22

def initialize(spec = Specification.new)
  @specification = spec
end

Instance Attribute Details

#specificationObject (readonly)

Returns the value of attribute specification.



20
21
22
# File 'lib/swagger_yard/swagger.rb', line 20

def specification
  @specification
end

Class Method Details

.new(*args) ⇒ Object



15
16
17
18
# File 'lib/swagger_yard/swagger.rb', line 15

def self.new(*args)
  return OpenAPI.object_new(*args) if SwaggerYard.config.swagger_version.start_with?("3.0")
  super
end

.object_newObject



13
# File 'lib/swagger_yard/swagger.rb', line 13

alias object_new new

Instance Method Details

#to_hObject



26
27
28
# File 'lib/swagger_yard/swagger.rb', line 26

def to_h
  .merge(definitions).merge(model_definitions)
end