module Roda::RodaPlugins::MatchHookArgs::ClassMethods

  1. lib/roda/plugins/match_hook_args.rb

Methods

Public Instance

  1. add_match_hook
  2. freeze

Public Instance methods

add_match_hook(&block)

Add a match hook that will be called with matchers and block args.

[show source]
   # File lib/roda/plugins/match_hook_args.rb
52 def add_match_hook(&block)
53   match_hook_args << define_roda_method("match_hook_args", :any, &block)
54 
55   if match_hook_args.length == 1
56     class_eval("alias _match_hook_args #{match_hook_args.first}", __FILE__, __LINE__)
57   else
58     class_eval("def _match_hook_args(v, a); #{match_hook_args.map{|m| "#{m}(v, a)"}.join(';')} end", __FILE__, __LINE__)
59   end
60 
61   public :_match_hook_args
62 
63   nil
64 end
freeze()

Freeze the array of hook methods when freezing the app

[show source]
   # File lib/roda/plugins/match_hook_args.rb
46 def freeze
47   match_hook_args.freeze
48   super
49 end