Ruby - How to use the hash_syntax gem?
-
22-02-2021 - |
Question
I found this gem https://github.com/michaeledgar/hash_syntax
I don't quite understand how I can use it even though it seems a simple gem. Should I write
hash_syntax --to-19
on the shell? Shouldn't I put something on the $PATH so it understands the command?
I also tried to run it through a ruby script (require gem and then run the above command) but it didn't work, it doesn't understand the command.
I've tried it on ubuntu 10.04, rvm and ruby 1.9.3
Solution
actually installing the gem via [sudo] gem install hash_syntax
should have put it in your PATH.
And yes, the syntax is pretty straightforward: hash_syntax --to-19 FILE
.
You could also consult hash_syntax --help
OTHER TIPS
You might want to use the other gem that solves the same problem but in slightly other way. Install:
gem install syntax_fix
Run in the project root:
syntax_fix -v
As the result, all the hashes will be converted (including nested files and directories)