Ruby - 如何使用 hash_syntax gem?
我发现了这个宝石 https://github.com/michaeledgar/hash_syntax
我不太明白我是如何即使它看起来很简单,也可以使用它。 写字吗
hash_syntax --to-19
我应该在外壳上 ?我不应该在 $PATH 上放一些东西以便它理解该命令吗?
我还尝试通过 ruby 脚本运行它(需要 gem,然后运行上面的命令),但它不起作用,它不理解该命令。
我在 ubuntu 10.04、rvm 和 ruby 1.9.3 上尝试过
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想使用另一个 gem 来解决相同的问题,但方式略有不同。
安装:
在项目根目录中运行:
结果,所有哈希值将被转换(包括嵌套文件和目录)
You might want to use the other gem that solves the same problem but in slightly other way.
Install:
Run in the project root:
As the result, all the hashes will be converted (including nested files and directories)
实际上通过
[sudo] gem install hash_syntax
安装 gem 应该将其放入您的 PATH 中。是的,语法非常简单:
hash_syntax --to-19 FILE
。您还可以参考
hash_syntax --help
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