hannesg / uri_template

A URI template library for ruby.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for symbols in hash passed to expand.

peterhellberg opened this issue · comments

I would like uri_template to support symbols in the hash keys passed to expand?

I think it would be quite nice to be able to use the Ruby 1.9 hash syntax to write something like this:

t = URITemplate.new('/search{?q,rows,start}')
t.expand q: 'something', rows: 10, start: 5

I’d be happy to implement the change if you think it would be a good idea 🤘

I've thought about this back and forth when I did the initial release. I always feel a bit bad about indifferent access but the new hash syntax is to cool to not use it. Let's allow it but make clear that the behavior for hashes with duplicated keys ( one as string, one as symbol ) is undefined. 👍