Class: Modern::DSL::Root
Instance Attribute Summary collapse
-
#descriptor ⇒ Object
readonly
Returns the value of attribute descriptor.
Attributes inherited from Scope
Class Method Summary collapse
Instance Method Summary collapse
- #info(&block) ⇒ Object
-
#initialize(descriptor) ⇒ Root
constructor
A new instance of Root.
- #server(url, description: nil) ⇒ Object
Methods inherited from Scope
#capsule, #clear_input_converters!, #clear_output_converters!, #clear_security!, #default_response, #delete, #deprecate!, evaluate, #get, #helper, #input_converter, #output_converter, #parameter, #patch, #path, #post, #put, #route, #security, #tag
Constructor Details
#initialize(descriptor) ⇒ Root
Returns a new instance of Root.
11 12 13 |
# File 'lib/modern/dsl/root.rb', line 11 def initialize(descriptor) super(descriptor, nil) end |
Instance Attribute Details
#descriptor ⇒ Object (readonly)
Returns the value of attribute descriptor.
9 10 11 |
# File 'lib/modern/dsl/root.rb', line 9 def descriptor @descriptor end |
Class Method Details
Instance Method Details
#info(&block) ⇒ Object
15 16 17 18 19 |
# File 'lib/modern/dsl/root.rb', line 15 def info(&block) @descriptor = @descriptor.copy( info: Info.build(descriptor.info.title, descriptor.info.version, &block).to_h ) end |
#server(url, description: nil) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/modern/dsl/root.rb', line 21 def server(url, description: nil) raise "url is required for a server declaration." if url.nil? @descriptor = @descriptor.copy( servers: @descriptor.servers + [Modern::Descriptor::Server.new(url: url, description: description)] ) end |