class Gack::Route
Route
is a Gemini request handler wrapper for a given path
Constants
- HandlerMissingError
Attributes
handler[R]
path[R]
Public Class Methods
new(path, &handler)
click to toggle source
# File lib/gack/route.rb, line 10 def initialize(path, &handler) @path = path raise HandlerMissingError unless handler @handler = handler end
Public Instance Methods
handle_request(request)
click to toggle source
# File lib/gack/route.rb, line 26 def handle_request(request) handler.call(request) end
path_match?(string)
click to toggle source
# File lib/gack/route.rb, line 18 def path_match?(string) if path.is_a?(Regexp) path.match?(string) else path.eql?(string) end end