diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-18 21:19:18 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-18 21:19:18 +0000 |
commit | 7bbf2f308580f468802cd7d32c94fce1b9f1779e (patch) | |
tree | 0a680f59e70a78d60e776d7b763e618fb2fec624 /lib/rexml/element.rb | |
parent | 34276148c4450faa77bb298cfbe005f7c263f802 (diff) | |
download | ruby-7bbf2f308580f468802cd7d32c94fce1b9f1779e.tar.gz |
* lib: Convert tabs to spaces for ruby files per
http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
Patch by Steve Klabnik [Ruby 1.9 - Bug #4730]
Patch by Jason Dew [Ruby 1.9 - Feature #4718]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/element.rb')
-rw-r--r-- | lib/rexml/element.rb | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index 97fbd0645b..0650824d6d 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -20,7 +20,7 @@ module REXML class Element < Parent include Namespace - UNDEFINED = "UNDEFINED"; # The default name + UNDEFINED = "UNDEFINED"; # The default name # Mechanisms for accessing attributes and child elements of this # element. @@ -31,17 +31,17 @@ module REXML # Constructor # arg:: - # if not supplied, will be set to the default value. - # If a String, the name of this object will be set to the argument. - # If an Element, the object will be shallowly cloned; name, - # attributes, and namespaces will be copied. Children will +not+ be - # copied. + # if not supplied, will be set to the default value. + # If a String, the name of this object will be set to the argument. + # If an Element, the object will be shallowly cloned; name, + # attributes, and namespaces will be copied. Children will +not+ be + # copied. # parent:: - # if supplied, must be a Parent, and will be used as - # the parent of this object. + # if supplied, must be a Parent, and will be used as + # the parent of this object. # context:: - # If supplied, must be a hash containing context items. Context items - # include: + # If supplied, must be a hash containing context items. Context items + # include: # * <tt>:respect_whitespace</tt> the value of this is :+all+ or an array of # strings being the names of the elements to respect # whitespace for. Defaults to :+all+. @@ -297,7 +297,7 @@ module REXML el = @elements.add(element) attrs.each do |key, value| el.attributes[key]=value - end if attrs.kind_of? Hash + end if attrs.kind_of? Hash el end @@ -667,7 +667,7 @@ module REXML # # Writes out this element, and recursively, all children. # output:: - # output an object which supports '<< string'; this is where the + # output an object which supports '<< string'; this is where the # document will be written. # indent:: # An integer. If -1, no indenting will be used; otherwise, the @@ -690,15 +690,15 @@ module REXML def write(output=$stdout, indent=-1, transitive=false, ie_hack=false) Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters") formatter = if indent > -1 - if transitive - require "rexml/formatters/transitive" - REXML::Formatters::Transitive.new( indent, ie_hack ) - else - REXML::Formatters::Pretty.new( indent, ie_hack ) - end - else - REXML::Formatters::Default.new( ie_hack ) - end + if transitive + require "rexml/formatters/transitive" + REXML::Formatters::Transitive.new( indent, ie_hack ) + else + REXML::Formatters::Pretty.new( indent, ie_hack ) + end + else + REXML::Formatters::Default.new( ie_hack ) + end formatter.write( self, output ) end @@ -778,7 +778,7 @@ module REXML else return XPath::first( @element, index ) #{ |element| - # return element if element.kind_of? Element + # return element if element.kind_of? Element #} #return nil end @@ -1086,7 +1086,7 @@ module REXML # doc.root.attributes['foo'] = '4' # doc.root.attributes['x:foo'] = nil def []=( name, value ) - if value.nil? # Delete the named attribute + if value.nil? # Delete the named attribute attr = get_attribute(name) delete attr return @@ -1116,8 +1116,8 @@ module REXML value.prefix != "xmlns" and old_attr.prefix != "xmlns" and @element.namespace( old_attr.prefix ) == @element.namespace( value.prefix ) - store value.name, { old_attr.prefix => old_attr, - value.prefix => value } + store value.name, { old_attr.prefix => old_attr, + value.prefix => value } else store value.name, value end @@ -1236,7 +1236,7 @@ module REXML ( !namespace.empty? || !attribute.fully_expanded_name.index(':') ) # foo will match xmlns:foo, but only if foo isn't also an attribute result = attribute if !result or !namespace.empty? or - !attribute.fully_expanded_name.index(':') + !attribute.fully_expanded_name.index(':') end } result |