Class: SwaggerYard::Paths

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_yard/api_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_itemsObject (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

#pathsObject



12
13
14
# File 'lib/swagger_yard/api_group.rb', line 12

def paths
  path_items.keys
end