[前][次][番号順一覧][スレッド一覧]

ruby-changes:29765

From: kou <ko1@a...>
Date: Sun, 7 Jul 2013 11:35:25 +0900 (JST)
Subject: [ruby-changes:29765] kou:r41817 (trunk): * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common

kou	2013-07-07 11:35:13 +0900 (Sun, 07 Jul 2013)

  New Revision: 41817

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41817

  Log:
    * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common
      cache clear code.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rexml/text.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 41816)
+++ ChangeLog	(revision 41817)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sun Jul  7 11:34:18 2013  Kouhei Sutou  <kou@c...>
+
+	* lib/rexml/text.rb (REXML::Text#clear_cache): Extract common
+	  cache clear code.
+
 Sun Jul  7 11:01:03 2013  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (RUBY_DTRACE_POSTPROCESS): dtrace version SUN D 1.11
Index: lib/rexml/text.rb
===================================================================
--- lib/rexml/text.rb	(revision 41816)
+++ lib/rexml/text.rb	(revision 41817)
@@ -103,7 +103,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/text.rb#L103
 
       @raw = raw unless raw.nil?
       @entity_filter = entity_filter
-      @normalized = @unnormalized = nil
+      clear_cache
 
       if arg.kind_of? String
         @string = arg.dup
@@ -256,8 +256,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/text.rb#L256
     #   e[0].value = "<a>"    # <a>&lt;a&gt;</a>
     def value=( val )
       @string = val.gsub( /\r\n?/, "\n" )
-      @unnormalized = nil
-      @normalized = nil
+      clear_cache
       @raw = false
     end
 
@@ -331,6 +330,12 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/text.rb#L330
       out << copy
     end
 
+    private
+    def clear_cache
+      @normalized = nil
+      @unnormalized = nil
+    end
+
     # Reads text, substituting entities
     def Text::read_with_substitution( input, illegal=nil )
       copy = input.clone

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]