Class: Mortymer::EndpointRegistry

Inherits:
Object
  • Object
show all
Defined in:
lib/mortymer/endpoint_registry.rb

Overview

A global registry of all defined endpoints

Class Method Summary collapse

Class Method Details

.clearObject



21
22
23
# File 'lib/mortymer/endpoint_registry.rb', line 21

def clear
  @registry = nil
end

.get_matcher(path, method) ⇒ Object



17
18
19
# File 'lib/mortymer/endpoint_registry.rb', line 17

def get_matcher(path, method)
  registry.find { |e| e.path.to_s == path.to_s && e.http_method.to_s == method.to_s }
end

.registryObject



7
8
9
10
11
12
13
14
15
# File 'lib/mortymer/endpoint_registry.rb', line 7

def registry
  if defined?(Rails.application) && Rails.application.config.cache_classes == false
    Rails.application.reloader.wrap do
      @registry ||= []
    end
  else
    @registry ||= []
  end
end