4
我試圖分區使用partition method from the String module字符串分區。但是,這樣做的時候:「測試」 .partition(「S」)調用從可枚舉模塊,而不是字符串模塊
puts "test".partition("s")
我收到以下錯誤信息:
Line 1:in `partition': wrong number of arguments (1 for 0) (ArgumentError) from t.rb:1
我相信,紅寶石調用partition method from the Enumerable module,而不是從我想要的字符串模塊之一。
我怎樣才能得到紅寶石調用所需的方法?
您使用的是哪個版本/平臺的Ruby? –
你可以把IRB以下的輸出: >> RUBY_VERSION >>「測試」 .partition(「S」) 如果你使用Ruby 1.8.6,字符串#分區不會做你認爲 –
我使用紅寶石1.8.4(2005-12-24)[i686-linux] –