summaryrefslogtreecommitdiff
path: root/lib/rexml/light
diff options
context:
space:
mode:
authorser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-15 18:31:16 +0000
committerser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-06-15 18:31:16 +0000
commit2403ad9e7de8976a83798f9d86f82f3b5ae0d2cd (patch)
treec0f4098655ece836190b90b412481b561d07e640 /lib/rexml/light
parent4d33715fe4b0c9750b4cf4e71166e8d67ecc8395 (diff)
REXML hadn't been tested with Ruby 1.8.0, which was really, really,
unbelievably stupid of me. There were a lot of warnings and some errors that were caused by Block vs. Proc differences; these have been fixed. REXML passes all of the tests under Ruby 1.8.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3943 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/light')
-rw-r--r--lib/rexml/light/node.rb25
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/rexml/light/node.rb b/lib/rexml/light/node.rb
index 5b7b95a7dc..680f2c23fe 100644
--- a/lib/rexml/light/node.rb
+++ b/lib/rexml/light/node.rb
@@ -42,7 +42,9 @@ module REXML
if node.kind_of? String
node = [ :text, node ]
elsif node.nil?
- node = [ :start_document, nil, nil ]
+ node = [ :document, nil, nil ]
+ elsif node[0] == :start_element
+ node[0] = :element
end
replace( node )
_old_put( 1, 0, 1 )
@@ -117,6 +119,10 @@ module REXML
end
end
+ def =~( path )
+ XPath.match( self, path )
+ end
+
# Doesn't handle namespaces yet
def []=( reference, ns, value=nil )
el!()
@@ -139,7 +145,7 @@ module REXML
# object. Otherwise, the element argument is a string, the namespace (if
# provided) is the namespace the element is created in.
def << element
- if text?
+ if node_type() == :text
at(-1) << element
else
newnode = Node.new( element )
@@ -150,7 +156,7 @@ module REXML
end
def node_type
- self[0]
+ _old_get(0)
end
def text=( foo )
@@ -163,10 +169,6 @@ module REXML
context = context.at(1) while context.at(1)
end
- def element?
- at(0) == :start_element
- end
-
def has_name?( name, namespace = '' )
el!()
at(3) == name and namespace() == namespace
@@ -181,19 +183,16 @@ module REXML
at(1)
end
- def text?
- at(0) == :text
- end
-
def to_s
end
def el!
- if text?()
- _old_put( 0, :start_element )
+ if node_type() != :element and node_type() != :document
+ _old_put( 0, :element )
push({})
end
+ self
end
private