Class: OasCore::OasRoute

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ OasRoute

Returns a new instance of OasRoute.



8
9
10
# File 'lib/oas_core/oas_route.rb', line 8

def initialize(attributes = {})
  attributes.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



5
6
7
# File 'lib/oas_core/oas_route.rb', line 5

def controller
  @controller
end

#docstringObject

Returns the value of attribute docstring.



5
6
7
# File 'lib/oas_core/oas_route.rb', line 5

def docstring
  @docstring
end

#method_nameObject

Returns the value of attribute method_name.



5
6
7
# File 'lib/oas_core/oas_route.rb', line 5

def method_name
  @method_name
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'lib/oas_core/oas_route.rb', line 5

def path
  @path
end

#source_stringObject

Returns the value of attribute source_string.



5
6
7
# File 'lib/oas_core/oas_route.rb', line 5

def source_string
  @source_string
end

#tags(name = nil) ⇒ Object



16
17
18
19
20
# File 'lib/oas_core/oas_route.rb', line 16

def tags(name = nil)
  return @tags if name.nil?

  @tags.select { |tag| tag.tag_name.to_s == name.to_s }
end

#verbObject

Returns the value of attribute verb.



5
6
7
# File 'lib/oas_core/oas_route.rb', line 5

def verb
  @verb
end

Instance Method Details

#path_paramsObject



12
13
14
# File 'lib/oas_core/oas_route.rb', line 12

def path_params
  @path.to_s.scan(/\{(\w+)\}/).flatten
end