diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-07 02:35:13 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-07-07 02:35:13 +0000 |
commit | afbc25c404c1bcda11bcb7a153be6f06d0b7865c (patch) | |
tree | 972775e08445bac523225663d53f402c36afeaef /lib | |
parent | 2114ad42da7ae4b5f8b592d74b6864a6c16dddd3 (diff) | |
download | ruby-afbc25c404c1bcda11bcb7a153be6f06d0b7865c.tar.gz |
* 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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rexml/text.rb | 11 |
1 files changed, 8 insertions, 3 deletions
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>" # <a><a></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 |