Class: SwaggerYard::Paths
- Inherits:
-
Object
- Object
- SwaggerYard::Paths
- Defined in:
- lib/swagger_yard/api_group.rb
Instance Attribute Summary collapse
-
#path_items ⇒ Object
readonly
Returns the value of attribute path_items.
Instance Method Summary collapse
-
#initialize(path_items) ⇒ Paths
constructor
A new instance of Paths.
- #merge(other) ⇒ Object
- #paths ⇒ Object
Constructor Details
#initialize(path_items) ⇒ Paths
Returns a new instance of Paths.
8 9 10 |
# File 'lib/swagger_yard/api_group.rb', line 8 def initialize(path_items) @path_items = path_items end |
Instance Attribute Details
#path_items ⇒ Object (readonly)
Returns the value of attribute path_items.
6 7 8 |
# File 'lib/swagger_yard/api_group.rb', line 6 def path_items @path_items end |
Instance Method Details
#merge(other) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/swagger_yard/api_group.rb', line 16 def merge(other) merged_items = {} (paths + other.paths).uniq.each do |path| merged_items[path] = (path_items[path] || PathItem.new) + (other.path_items[path] || PathItem.new) end Paths.new(merged_items) end |
#paths ⇒ Object
12 13 14 |
# File 'lib/swagger_yard/api_group.rb', line 12 def paths path_items.keys end |