Class: Rails::Openapi::Endpoint

Inherits:
Struct
  • Object
show all
Defined in:
lib/rails/openapi/router.rb

Overview

Internally represents individual routes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*opts) ⇒ Endpoint

Returns a new instance of Endpoint.



5
6
7
8
# File 'lib/rails/openapi/router.rb', line 5

def initialize *opts
  super
  self[:_path] = path
end

Instance Attribute Details

#_pathObject

Returns the value of attribute _path

Returns:

  • (Object)

    the current value of _path



4
5
6
# File 'lib/rails/openapi/router.rb', line 4

def _path
  @_path
end

#definitionObject

Returns the value of attribute definition

Returns:

  • (Object)

    the current value of definition



4
5
6
# File 'lib/rails/openapi/router.rb', line 4

def definition
  @definition
end

#methodObject

Returns the value of attribute method

Returns:

  • (Object)

    the current value of method



4
5
6
# File 'lib/rails/openapi/router.rb', line 4

def method
  @method
end

#urlObject

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



4
5
6
# File 'lib/rails/openapi/router.rb', line 4

def url
  @url
end

Instance Method Details

#pathObject

Translates path params from bracket syntax to :symbol syntax



11
12
13
# File 'lib/rails/openapi/router.rb', line 11

def path
  self[:url].gsub(/\{([^}]+)\}/, ':\\1')
end