summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-07 02:48:35 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-07 02:48:35 +0000
commitfbaec78eb331cce46e640241b074bd7091509d67 (patch)
tree09817df4e426527824984893cf6929cca1a71079 /lib/rexml
parentafbc25c404c1bcda11bcb7a153be6f06d0b7865c (diff)
* 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
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/text.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb
index 90099f4..0e45265 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