Class: Swaggard::Swagger::Path
- Inherits:
-
Object
- Object
- Swaggard::Swagger::Path
- Defined in:
- lib/swaggard/swagger/path.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_operation(operation) ⇒ Object
-
#initialize(path) ⇒ Path
constructor
A new instance of Path.
- #to_doc ⇒ Object
Constructor Details
#initialize(path) ⇒ Path
Returns a new instance of Path.
9 10 11 12 |
# File 'lib/swaggard/swagger/path.rb', line 9 def initialize(path) @path = path @operations = {} end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/swaggard/swagger/path.rb', line 7 def path @path end |
Instance Method Details
#add_operation(operation) ⇒ Object
14 15 16 |
# File 'lib/swaggard/swagger/path.rb', line 14 def add_operation(operation) @operations[operation.http_method.downcase] = operation end |
#to_doc ⇒ Object
18 19 20 |
# File 'lib/swaggard/swagger/path.rb', line 18 def to_doc Hash[@operations.map { |http_method, operation| [http_method, operation.to_doc] }] end |