mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
This commit is contained in:
parent
4d33715fe4
commit
2403ad9e7d
5 changed files with 28 additions and 26 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue