全局及本地的irbrc文件

I really like the way the Git SCM handles global and local configurations. Globally, you have .gitconfig and .gitignore files which define how Git behaves across all projects. Locally, you have .gitignore and .git/config files which are applied specifically to the current directory or project. This approach works very well and this morning I tried applying it to the way Ruby’s IRB works. With IRB,...

November 25, 2014

Ruby备注

切换ruby版本:rvm 2.0.0 –default 字符串中变量替换: #{变量名}我了个大擦" 特殊符号mysql无法识别的问题: MySQL的UTF8字符集不...

September 29, 2014

Autocomplete and colorize your ruby shell

Ruby Shell (irb) 自动补全和颜色高量 首先安装名为 wirble 的Gems包: sudo gem install wirble 其次,在 ~/.irbrc 文件中,添加如下内容: #!/usr/bin/ruby require 'irb/completion' require 'rubygems' require 'wirble' Wirble.init Wirble.colorize OK,安装完成,现在输入命令 irb...

January 12, 2014

ruby中从inspect出来的string创建对象

和别的语言类似,通过 eval("string") 实现。 例如: obj = eval(“{:a=>1,:b=>2}”) 这样,obj变成了一个哈希表: {:a=>1,:b=>2}

December 13, 2013