2011-03-30 77 views
1

我想在IRB指南針,這是我的代碼:如何初始化指南針的記錄器?

C:\Documents and Settings\test>irb 

irb(main):001:0> require 'rubygems' 
=> true 
irb(main):002:0> require 'compass' 
=> true 
irb(main):003:0> logger = Compass::Logger.new() 
NameError: uninitialized constant Compass::Logger 
     from E:/Ruby187/lib/ruby/gems/1.8/gems/compass-0.10.6/lib/compass/versio 
n.rb:51:in `const_missing' 
     from (irb):3 
irb(main):004:0> 

但是有一個Loggercompass/loggers.rb

module Compass 
    class Logger 
     DEFAULT_ACTIONS = [:directory, :exists, ...] 

哪裏錯了?

回答

2

嘗試:

irb(main):001:0> require 'rubygems' 
=> true 
irb(main):002:0> require 'compass/logger' # <- note the path 
=> true 
irb(main):003:0> logger = Compass::Logger.new() 
=> #<Compass::Logger:0x1011423f8 @actions=[:directory, :exists, :remove, :create, :overwrite, :compile, :error, :identical, :warning], @options={}> 
+0

非常感謝你! – Freewind 2011-03-30 05:04:52

+1

如果最終解決了問題,你能接受嗎? – yan 2011-03-30 05:09:11

+0

當然。我幾個小時前嘗試過,但那還爲時過早 – Freewind 2011-03-30 08:07:11