class Sliver::Endpoints

Attributes

paths[R]

Public Class Methods

new() click to toggle source
# File lib/sliver/endpoints.rb, line 2
def initialize
  @paths = {}
end

Public Instance Methods

append(path, action) click to toggle source
# File lib/sliver/endpoints.rb, line 6
def append(path, action)
  paths[path] = action
end
find(environment) click to toggle source
# File lib/sliver/endpoints.rb, line 10
def find(environment)
  key = paths.keys.detect { |key| key.matches?(environment) }
  return nil unless key

  environment[Sliver::PATH_KEY] = key
  paths[key]
end