Class: Alchemy::RoutingConstraints

Inherits:
Object
  • Object
show all
Defined in:
lib/alchemy/routing_constraints.rb

Overview

Routing constraints for Alchemy’s strong catch all route.

Alchemy has a very strong catch all route. But we don’t want to handle all requests.

For instance we only want to handle html requests and don’t want to swallow the rails/info routes in development mode.

Constant Summary collapse

LOCALE_REGEXP =
/[a-z]{2}(-[a-z]{2})?/

Instance Method Summary collapse

Instance Method Details

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
# File 'lib/alchemy/routing_constraints.rb', line 14

def matches?(request)
  @request = request
  @params = @request.params

  handable_format? && no_rails_route?
rescue ArgumentError => e
  handle_invalid_byte_sequence(e)
end