summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/text.rb11
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>&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
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