lib/deas/url.rb in deas-0.41.0 vs lib/deas/url.rb in deas-0.42.0
- old
+ new
@@ -21,23 +21,21 @@
def path_for(params = {})
raise NonHashParamsError if !params.kind_of?(::Hash)
h = params.dup # don't alter the given params
c = h.delete(:captures) || h.delete('captures') || []
- s = h.delete(:splat) || h.delete('splat') || []
+ s = h.delete(:splat) || h.delete('splat') || nil
a = h.delete(:'#') || h.delete('#') || nil
# ignore captures when setting params
# remove duplicate forward slashes
set_anchor(set_extra(set_named(set_splat(@path, s), h), h), a).gsub(/\/\/+/, '/')
end
private
- def set_splat(path, params)
- params.inject(path) do |path_string, value|
- path_string.sub(/\*+/, value.to_s)
- end
+ def set_splat(path, value)
+ path.sub(/\*+/, value.to_s)
end
def set_named(path, params)
params.inject(path) do |path_string, (name, value)|
if path_string.include?(":#{name}")