Class: R2OAS::Routing::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/r2-oas/routing/parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(routes) ⇒ Parser

routes should be Rails.application.routes.routes



10
11
12
13
# File 'lib/r2-oas/routing/parser.rb', line 10

def initialize(routes)
  @_routes = routes
  @_engines = {}
end

Instance Method Details

#routes_dataObject



15
16
17
18
19
20
21
# File 'lib/r2-oas/routing/parser.rb', line 15

def routes_data
  data = []
  normalized_routes do |route_els|
    data.push *route_els
  end
  data
end

#schemas_dataObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/r2-oas/routing/parser.rb', line 34

def schemas_data
  data = []
  normalized_routes do |route_els|
    route_els.each do |route_el|
      schema_name = route_el[:data][:schema_name]
      data.push schema_name unless data.include?(schema_name)
    end
  end
  data
end

#tags_dataObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/r2-oas/routing/parser.rb', line 23

def tags_data
  data = []
  normalized_routes do |route_els|
    route_els.each do |route_el|
      tag_name = route_el[:data][:tag_name]
      data.push tag_name unless data.include?(tag_name)
    end
  end
  data
end