Module: Roda::RodaPlugins::MatchHook::ClassMethods
- Defined in:
- lib/roda/plugins/match_hook.rb
Instance Method Summary collapse
-
#freeze ⇒ Object
Freeze the array of hook methods when freezing the app.
-
#match_hook(&block) ⇒ Object
Add a match hook.
Instance Method Details
#freeze ⇒ Object
Freeze the array of hook methods when freezing the app
21 22 23 24 |
# File 'lib/roda/plugins/match_hook.rb', line 21 def freeze opts[:match_hooks].freeze super end |
#match_hook(&block) ⇒ Object
Add a match hook.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/roda/plugins/match_hook.rb', line 27 def match_hook(&block) opts[:match_hooks] << define_roda_method("match_hook", 0, &block) if opts[:match_hooks].length == 1 class_eval("alias _match_hook #{opts[:match_hooks].first}", __FILE__, __LINE__) else class_eval("def _match_hook; #{opts[:match_hooks].join(';')} end", __FILE__, __LINE__) end public :_match_hook nil end |