From fbaec78eb331cce46e640241b074bd7091509d67 Mon Sep 17 00:00:00 2001 From: kou Date: Sun, 7 Jul 2013 02:48:35 +0000 Subject: * lib/rexml/text.rb (REXML::Text#<<): Support method chain use by "<<" like other objects. * test/rexml/test_text.rb (TextTester#test_shift_operator_chain): Add a test for the above case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 +++++++ lib/rexml/text.rb | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/ChangeLog b/ChangeLog index f84d1f9929..a78b0f9f8f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sun Jul 7 11:43:13 2013 Kouhei Sutou + + * lib/rexml/text.rb (REXML::Text#<<): Support method chain use by "<<" + like other objects. + * test/rexml/test_text.rb (TextTester#test_shift_operator_chain): + Add a test for the above case. + Sun Jul 7 11:34:18 2013 Kouhei Sutou * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb index 90099f4566..0e45265a17 100644 --- a/lib/rexml/text.rb +++ b/lib/rexml/text.rb @@ -186,8 +186,12 @@ module REXML # Appends text to this text node. The text is appended in the +raw+ mode # of this text node. + # + # +returns+ the text itself to enable method chain like + # 'text << "XXX" << "YYY"'. def <<( to_append ) @string << to_append.gsub( /\r\n?/, "\n" ) + self end -- cgit v1.2.3