From afbc25c404c1bcda11bcb7a153be6f06d0b7865c Mon Sep 17 00:00:00 2001 From: kou Date: Sun, 7 Jul 2013 02:35:13 +0000 Subject: * lib/rexml/text.rb (REXML::Text#clear_cache): Extract common cache clear code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rexml/text.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/rexml') diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb index 23b17a7608..90099f4566 100644 --- a/lib/rexml/text.rb +++ b/lib/rexml/text.rb @@ -103,7 +103,7 @@ module REXML @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 # e[0].value = "" # <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 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 -- cgit v1.2.3