Bug #2546

REXMLでString::eachを使用しているため1.9でNo Method Error

Added by takkanm (三村 益隆) over 2 years ago. Updated about 1 year ago.

[ruby-dev:39949]
Status:Closed Start date:01/02/2010
Priority:Normal Due date:
Assignee:- % Done:

100%

Category:lib
Target version:2.0.0
ruby -v:ruby 1.9.2dev (2010-01-02 trunk 26229)

Description

takkanm です。

RubySpecを動かしていて気付いたのですが、1.9に添付されているREXMLにてString::eachを使用していて1.9で動かない箇所(lib/rexml/text.rb)があります。

ソースを見ると以下のようにeach_lineに変更すれば問題ないようですが、いかがでしょうか?
--- a/lib/rexml/text.rb
+++ b/lib/rexml/text.rb
@@ -274,7 +274,7 @@ module REXML
     def indent_text(string, level=1, style="\t", indentfirstline=true)
       return string if level < 0
       new_string = ''
-      string.each { |line|
+      string.each_line { |line|
         indent_string = style * level
         new_line = (indent_string + line).sub(/[\s]+$/,'')
         new_string << new_line

以上、よろしくお願いします。

Associated revisions

Revision 26234
Added by yugui (Yuki Sonoda) over 2 years ago

* lib/rexml/text.rb: String no longer has #each. Patch by Mitsutaka Mimura (takkanm). [ruby-dev:39949].

History

Updated by yugui (Yuki Sonoda) over 2 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100
This issue was solved with changeset r26234.
三村, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

Also available in: Atom PDF