pry include gem to debug


% irb -Ilib -rhola
irb(main):001:0> Hola.hi("english")
=> "hello world"
irb(main):002:0> Hola.hi("spanish")
=> "hola mundo"

-I指把lib目录加入load_path,-r表示require这个文件

vagrant@precise64:~/data$ pry -Iinclude -r1
[1] pry(main)> Hold.test
lala
=> nil
[2] pry(main)> exit
vagrant@precise64:~/data$ ls -al include/
total 13
drwxrwxrwx 1 vagrant vagrant     0 Jun 15 14:42 .
drwxrwxrwx 1 vagrant vagrant 12288 Jun 15 14:41 ..
-rwxrwxrwx 1 vagrant vagrant   106 Jun 15 14:43 1.rb
class Hold
    def self.test
        A.lala
    end
end

class Hold::A
    def self.lala
        puts "lala"
    end
end

rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification

升级rubygems

gem update --system