Skip to content
This repository has been archived by the owner on Sep 13, 2017. It is now read-only.

Route#format is inconsistent for optional substrings #50

Open
dougo opened this issue Oct 15, 2012 · 0 comments
Open

Route#format is inconsistent for optional substrings #50

dougo opened this issue Oct 15, 2012 · 0 comments

Comments

@dougo
Copy link

dougo commented Oct 15, 2012

Route#format gets a little confused when an optional substring doesn't include a symbol argument:

#!/usr/bin/env ruby

require 'journey'

def format(path, opts = {})
  pattern = Journey::Path::Pattern.new(path)
  route = Journey::Route.new(nil, nil, pattern, {})
  route.format(opts)
end

puts format('/foo(bar)')
puts format('/foo(bar)/:baz', :baz => 42)

# output:
#
# bash-3.2$ ./journey_bug.rb
# /foo
# /foobar/42
#
# Why are these not either both foo or both foobar?
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant