如果我require ap
,irb返回true(我假設告訴我awesomeprint gem已成功加載)。但是,如果我發出命令ap f
其中f
是亂碼,我得到:awesomeprint in irb無法識別
NoMethodError: undefined method `ap' for main:Object
from (irb):5
from /usr/local/bin/irb:12:in `<main>'
的思考?
這裏是我的$ LOAD_PATH:
"/usr/local/lib/ruby/gems/1.9.1/gems/multi_json-1.1.0/lib", "/usr/local/lib/ruby/gems/1.9.1/gems/multi_xml-0.4.1/lib", "/usr/local/lib/ruby/gems/1.9.1/gems/httparty-0.8.1/lib", "/usr/local/lib/ruby/gems/1.9.1/gems/ap-0.1.1/lib", "/usr/local/lib/ruby/gems/1.9.1/gems/psych-1.2.2/lib", "/usr/local/lib/ruby/gems/1.9.1/gems/crack-0.3.1/lib", "/usr/local/lib/ruby/site_ruby/1.9.1", "/usr/local/lib/ruby/site_ruby/1.9.1/x86_64-darwin11.3.0", "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/vendor_ruby/1.9.1", "/usr/local/lib/ruby/vendor_ruby/1.9.1/x86_64-darwin11.3.0", "/usr/local/lib/ruby/vendor_ruby", "/usr/local/lib/ruby/1.9.1", "/usr/local/lib/ruby/1.9.1/x86_64-darwin11.3.0"
看來AP是第四之一。
'defined?(AwesomePrint)'的結果是什麼? – Segfault 2012-02-20 02:13:52
無。這看起來不太好。我一定要嘗試重新安裝它('sudo gem install ap')並且它成功了 – Chris 2012-02-20 02:23:28
我認爲在你的加載路徑中有另一個ap.rb。 – Segfault 2012-02-20 02:24:46