Class: OasRails::Spec::Specification
- Inherits:
-
Object
- Object
- OasRails::Spec::Specification
- Includes:
- Specable
- Defined in:
- lib/oas_rails/spec/specification.rb
Instance Attribute Summary collapse
-
#components ⇒ Object
Returns the value of attribute components.
-
#external_docs ⇒ Object
Returns the value of attribute external_docs.
-
#info ⇒ Object
Returns the value of attribute info.
-
#openapi ⇒ Object
Returns the value of attribute openapi.
-
#paths ⇒ Object
Returns the value of attribute paths.
-
#servers ⇒ Object
Returns the value of attribute servers.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #build(route_extractor: Extractors::RouteExtractor) ⇒ Object
-
#clear_cache ⇒ void
Clears the cache for MethodSource and RouteExtractor.
-
#initialize ⇒ Specification
constructor
Initializes a new Specification object.
- #oas_fields ⇒ Object
-
#security ⇒ Object
Create the Security Requirement Object.
Methods included from Specable
Constructor Details
#initialize ⇒ Specification
Initializes a new Specification object. Clears the cache if running in the development environment.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/oas_rails/spec/specification.rb', line 11 def initialize clear_cache unless Rails.env.production? @components = Components.new(self) @info = OasRails.config.info @openapi = '3.1.0' @servers = OasRails.config.servers @tags = OasRails.config. @external_docs = {} @paths = Spec::Paths.new(self) end |
Instance Attribute Details
#components ⇒ Object
Returns the value of attribute components.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def components @components end |
#external_docs ⇒ Object
Returns the value of attribute external_docs.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def external_docs @external_docs end |
#info ⇒ Object
Returns the value of attribute info.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def info @info end |
#openapi ⇒ Object
Returns the value of attribute openapi.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def openapi @openapi end |
#paths ⇒ Object
Returns the value of attribute paths.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def paths @paths end |
#servers ⇒ Object
Returns the value of attribute servers.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def servers @servers end |
#tags ⇒ Object
Returns the value of attribute tags.
7 8 9 |
# File 'lib/oas_rails/spec/specification.rb', line 7 def @tags end |
Instance Method Details
#build(route_extractor: Extractors::RouteExtractor) ⇒ Object
23 24 25 26 27 |
# File 'lib/oas_rails/spec/specification.rb', line 23 def build(route_extractor: Extractors::RouteExtractor) route_extractor.host_paths.each do |path| @paths.add_path(path) end end |
#clear_cache ⇒ void
This method returns an undefined value.
Clears the cache for MethodSource and RouteExtractor.
32 33 34 35 |
# File 'lib/oas_rails/spec/specification.rb', line 32 def clear_cache MethodSource.clear_cache Extractors::RouteExtractor.clear_cache end |
#oas_fields ⇒ Object
37 38 39 |
# File 'lib/oas_rails/spec/specification.rb', line 37 def oas_fields [:openapi, :info, :servers, :paths, :components, :security, :tags, :external_docs] end |