Class: RoutingFilter::Uuid
- Defined in:
- lib/routing_filter/filters/uuid.rb
Constant Summary collapse
- UUID_SEGMENT =
%r(^/?([a-z\d]{8}\-[a-z\d]{4}\-[a-z\d]{4}\-[a-z\d]{4}\-[a-z\d]{12})(/)?)
Instance Attribute Summary
Attributes inherited from Filter
Instance Method Summary collapse
Methods inherited from Filter
#initialize, #run, #run_reverse
Constructor Details
This class inherits a constructor from RoutingFilter::Filter
Instance Method Details
#around_generate(params, &block) ⇒ Object
33 34 35 36 37 38 |
# File 'lib/routing_filter/filters/uuid.rb', line 33 def around_generate(params, &block) uuid = params.delete(:uuid) yield.tap do |result| prepend_segment!(result, uuid) if uuid end end |
#around_recognize(path, env, &block) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/routing_filter/filters/uuid.rb', line 26 def around_recognize(path, env, &block) uuid = extract_segment!(UUID_SEGMENT, path) yield.tap do |params| params[:uuid] = uuid if uuid end end |