Class: OasCore::Builders::SpecificationBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/oas_core/builders/specification_builder.rb

Instance Method Summary collapse

Constructor Details

#initializeSpecificationBuilder

Returns a new instance of SpecificationBuilder.



6
7
8
# File 'lib/oas_core/builders/specification_builder.rb', line 6

def initialize
  @specification = Spec::Specification.new
end

Instance Method Details

#buildObject



19
20
21
# File 'lib/oas_core/builders/specification_builder.rb', line 19

def build
  @specification
end

#with_oas_routes(oas_routes) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/oas_core/builders/specification_builder.rb', line 10

def with_oas_routes(oas_routes)
  grouped_routes = oas_routes.group_by(&:path)
  grouped_routes.each do |path, routes|
    @specification.paths.add_path(path, routes)
  end

  self
end