Top Level Namespace
Defined Under Namespace
Modules: CloudFile Classes: File, Object, Tokens
Instance Method Summary collapse
Instance Method Details
#process_route(route, pattern, keys, conditions, block = nil, values = []) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/cloud_file/cloud_uri/dsl.rb', line 64 def process_route(route, pattern, keys, conditions, block = nil, values = []) route = '/' if route.empty? and not settings.empty_path_info? return unless match = pattern.match(route) values += match.captures.to_a.map { |v| force_encoding URI.decode(v) if v } if values.any? original, @params = params, params.merge('splat' => [], 'captures' => values) keys.zip(values) { |k,v| Array === @params[k] ? @params[k] << v : @params[k] = v if v } end catch(:pass) do conditions.each { |c| throw :pass if c.bind(self).call == false } block ? block[self, values] : yield(self, values) end ensure @params = original if original end |