Object
# File lib/routing_filter/filter.rb, line 5 def initialize(options = {}) @options = options end
# File lib/routing_filter/filter.rb, line 9 def run(method, *args, &block) _next = self.next ? proc {|path, env| self.next.run(method, *args, &block) } : block RoutingFilter.active? ? send(method, *args, &_next) : _next.call(*args) end
# File lib/routing_filter/filter.rb, line 14 def run_reverse(method, *args, &block) _prev = previous ? lambda { previous.run_reverse(method, *args, &block) } : block RoutingFilter.active? ? send(method, *args, &_prev) : _prev.call(*args) end
# File lib/routing_filter/filter.rb, line 32 def append_segment!(result, segment) url = result.is_a?(Array) ? result.first : result url.sub!(%(/?($|\?))) { "/#{segment}#{$1}" } end
# File lib/routing_filter/filter.rb, line 21 def extract_segment!(pattern, path) path.sub!(pattern) { $2 || '' } path.replace('/') if path.empty? $1 end
# File lib/routing_filter/filter.rb, line 27 def prepend_segment!(result, segment) url = result.is_a?(Array) ? result.first : result url.sub!(%(^(http.?://[^/]*)?(.*))) { "#{$1}/#{segment}#{$2 == '/' ? '' : $2}" } end
[Validate]
Generated with the Darkfish Rdoc Generator 2.