Class: ActionMCP::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/action_mcp/engine.rb

Overview

Engine for integrating ActionMCP with Rails applications.

Class Method Summary collapse

Class Method Details

.endpoint_path_matcher(path) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/action_mcp/engine.rb', line 12

def self.endpoint_path_matcher(path)
  endpoint = ActionDispatch::Journey::Router::Utils.normalize_path(path)
  formatted_endpoint = /\A#{Regexp.escape(endpoint)}(?:\.[^\/.]+)?\z/

  lambda do |request_path|
    normalized_path = ActionDispatch::Journey::Router::Utils.normalize_path(request_path)
    formatted_endpoint.match?(normalized_path)
  end
end