From 8fd29e2019077205a9997308cf3bc05202a83ad1 Mon Sep 17 00:00:00 2001 From: ser Date: Sun, 16 May 2004 15:17:31 +0000 Subject: ------------------------------------------------------------------------ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rexml/element.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/rexml/element.rb') diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index 40cac168b9..6456518cd7 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 "" # new_a = d.root.clone -- cgit v1.2.3