Class: OpenapiRuby::DSL::MetadataStore
- Inherits:
-
Object
- Object
- OpenapiRuby::DSL::MetadataStore
- Defined in:
- lib/openapi_ruby/dsl/metadata_store.rb
Class Method Summary collapse
Instance Method Summary collapse
- #all_contexts ⇒ Object
- #clear! ⇒ Object
- #contexts_for(schema_name) ⇒ Object
-
#initialize ⇒ MetadataStore
constructor
A new instance of MetadataStore.
- #register(context) ⇒ Object
Constructor Details
#initialize ⇒ MetadataStore
Returns a new instance of MetadataStore.
14 15 16 |
# File 'lib/openapi_ruby/dsl/metadata_store.rb', line 14 def initialize @contexts = [] end |
Class Method Details
.instance ⇒ Object
7 8 9 |
# File 'lib/openapi_ruby/dsl/metadata_store.rb', line 7 def instance @instance ||= new end |
Instance Method Details
#all_contexts ⇒ Object
27 28 29 |
# File 'lib/openapi_ruby/dsl/metadata_store.rb', line 27 def all_contexts @contexts.dup end |
#clear! ⇒ Object
31 32 33 |
# File 'lib/openapi_ruby/dsl/metadata_store.rb', line 31 def clear! @contexts = [] end |
#contexts_for(schema_name) ⇒ Object
22 23 24 25 |
# File 'lib/openapi_ruby/dsl/metadata_store.rb', line 22 def contexts_for(schema_name) schema_name = schema_name&.to_sym @contexts.select { |c| c.schema_name.nil? || c.schema_name&.to_sym == schema_name } end |
#register(context) ⇒ Object
18 19 20 |
# File 'lib/openapi_ruby/dsl/metadata_store.rb', line 18 def register(context) @contexts << context end |