Class: Minitest::Apidoc::Endpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/minitest/apidoc/endpoint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEndpoint


6
7
8
9
10
# File 'lib/minitest/apidoc/endpoint.rb', line 6

def initialize
  @metadata = {}
  @examples = []
  @params   = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &block) ⇒ Object


20
21
22
# File 'lib/minitest/apidoc/endpoint.rb', line 20

def method_missing(name, *args, &block)
  @metadata[name]
end

Instance Attribute Details

#examplesObject

Returns the value of attribute examples


4
5
6
# File 'lib/minitest/apidoc/endpoint.rb', line 4

def examples
  @examples
end

#metadataObject

Returns the value of attribute metadata


4
5
6
# File 'lib/minitest/apidoc/endpoint.rb', line 4

def 
  @metadata
end

#paramsObject

Returns the value of attribute params


4
5
6
# File 'lib/minitest/apidoc/endpoint.rb', line 4

def params
  @params
end

Instance Method Details

#html_anchorObject


12
13
14
# File 'lib/minitest/apidoc/endpoint.rb', line 12

def html_anchor
  "#{@metadata[:request_method]}-#{@metadata[:request_path]}"
end

#html_classObject


16
17
18
# File 'lib/minitest/apidoc/endpoint.rb', line 16

def html_class
  @metadata[:request_method].downcase
end

#respond_to?(name) ⇒ Boolean


24
25
26
# File 'lib/minitest/apidoc/endpoint.rb', line 24

def respond_to?(name)
  @metadata.include?(name) || super
end