diff options
| author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-16 19:08:03 +0000 |
|---|---|---|
| committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-16 19:08:03 +0000 |
| commit | 148fef736d60c6115fce45e3eb662743f07c251c (patch) | |
| tree | 5fbc86b061de7618c69e6469d18805f6b376cc1d /lib/rexml/element.rb | |
| parent | 93423022078ffdac84f7f8fd632e8105f92323ed (diff) | |
| download | ruby-148fef736d60c6115fce45e3eb662743f07c251c.tar.gz ruby-148fef736d60c6115fce45e3eb662743f07c251c.tar.xz ruby-148fef736d60c6115fce45e3eb662743f07c251c.zip | |
Cross-ported the REXML changes (3.0.8) from the development branch to the
stable branch.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/element.rb')
| -rw-r--r-- | lib/rexml/element.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index 40cac168b..ffc81bed9 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -67,6 +67,22 @@ module REXML end end + def inspect + rv = "<#@expanded_name" + + @attributes.each_attribute do |attr| + rv << " " + attr.write( rv, 0 ) + end unless @attributes.empty? + + if children.size > 0 + rv << " ... </>" + else + rv << "/>" + end + end + + # Creates a shallow copy of self. # d = Document.new "<a><b/><b/><c><d/></c></a>" # new_a = d.root.clone @@ -643,7 +659,7 @@ module REXML end writer << "/" else - if transitive and indent>-1 and !@children[0].kind_of? Text + if transitive and indent>-1 and !@children[0].instance_of? Text writer << "\n" indent writer, indent+1 end |
