module Roda::RodaPlugins::IntegerMatcherMax

  1. lib/roda/plugins/Integer_matcher_max.rb

The Integer_matcher_max plugin sets the maximum integer value value that the Integer class matcher will match by default. By default, loading this plugin sets the maximum value to 2**63-1, the largest signed 64-bit integer value:

plugin :Integer_matcher_max
route do |r| Integer do
    # Matches /9223372036854775807
    # Does not match /9223372036854775808

To specify a different maximum value, you can pass a different maximum value when loading the plugin:

plugin :Integer_matcher_max, 2**64-1


Public Class

  1. configure

Public Class methods

configure(app, max=nil)
[show source]
   # File lib/roda/plugins/Integer_matcher_max.rb
24 def self.configure(app, max=nil)
25   if max
26     app::RodaRequest.class_eval do
27       define_method(:_match_class_max_Integer){max}
28       alias_method :_match_class_max_Integer, :_match_class_max_Integer
29       private :_match_class_max_Integer
30     end
31   end
32 end