bploetz/versionist — pull request #51 by tombu (2013-08-23 11:47:47+00:00)
Title: Fix controller generator for ruby 1.9 hash syntax routes

As already mentioned in #44 I encountered problems with the `new_controller` generator when using the new hash syntax (Ruby >= 1.9). I took a look at the generator code and found the problems origin. It´s this regular expression: `/api_version.*:module\s*(=>|:)\s*("|')#{module_name_for_route(module_name)}("|')/` in https://github.com/bploetz/versionist/blob/master/lib/generators/versionist/new_controller/new_controller_generator.rb#L15

I added a `?` in between the `:` and `module` to make the colon optional.

Ruby < 1.9:
```
api_version(:module => 'v1', :header => 'Accept', :value => 'application/vnd.mycompany.com; version=1') do
...
end
```
=> http://rubular.com/r/yUvIUVf79l

Ruby >= 1.9:
```
api_version(module: 'v1', header: 'Accept', value: 'application/vnd.mycompany.com; version=1') do
...
end
````
=> http://rubular.com/r/yeXkMTf6Et

Do you want me to add specs for that? If yes, do you have a suggestions to do it without introducing a lot of duplicated code?