From 8ef5da3be1577bb5ae7f55b60cf9fedb10ecb85e Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 16 Oct 2003 17:47:19 +0000 Subject: consistent parentheses in assignment RHS. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4790 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rexml/dtd/entitydecl.rb | 2 +- lib/rexml/dtd/notationdecl.rb | 2 +- lib/rexml/element.rb | 16 ++++++++-------- lib/rexml/light/node.rb | 4 ++-- lib/rexml/source.rb | 2 +- lib/rexml/text.rb | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) (limited to 'lib/rexml') diff --git a/lib/rexml/dtd/entitydecl.rb b/lib/rexml/dtd/entitydecl.rb index 83156dfc71..164825570f 100644 --- a/lib/rexml/dtd/entitydecl.rb +++ b/lib/rexml/dtd/entitydecl.rb @@ -48,7 +48,7 @@ module REXML def EntityDecl.parse_source source, listener md = source.match( PATTERN_RE, true ) - thing = md[0].squeeze " \t\n\r" + thing = md[0].squeeze(" \t\n\r") listener.send inspect.downcase, thing end end diff --git a/lib/rexml/dtd/notationdecl.rb b/lib/rexml/dtd/notationdecl.rb index 09b6743c5c..d577ce0631 100644 --- a/lib/rexml/dtd/notationdecl.rb +++ b/lib/rexml/dtd/notationdecl.rb @@ -31,7 +31,7 @@ module REXML def NotationDecl.parse_source source, listener md = source.match( PATTERN_RE, true ) - thing = md[0].squeeze " \t\n\r" + thing = md[0].squeeze(" \t\n\r") listener.send inspect.downcase, thing end end diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb index 89e419345c..ffaeddbf54 100644 --- a/lib/rexml/element.rb +++ b/lib/rexml/element.rb @@ -52,8 +52,8 @@ module REXML def initialize( arg = UNDEFINED, parent=nil, context=nil ) super(parent) - @elements = Elements.new self - @attributes = Attributes.new self + @elements = Elements.new(self) + @attributes = Attributes.new(self) @context = context if arg.kind_of? String @@ -253,7 +253,7 @@ module REXML # el = Element.new 'my-tag' # doc.add_element el def add_element element=nil, attrs=nil - el = @elements.add element + el = @elements.add(element) if attrs.kind_of? Hash attrs.each do |key, value| el.attributes[key]=value if key =~ /^xmlns:/ @@ -412,7 +412,7 @@ module REXML # # The element 'p' has two text elements, "some text " and " more text". # doc.root.text #-> "some text " def text( path = nil ) - rv = get_text path + rv = get_text(path) return rv.value unless rv.nil? nil end @@ -724,7 +724,7 @@ module REXML def []( index, name=nil) if index.kind_of? Integer raise "index (#{index}) must be >= 1" if index < 1 - name = literalize name if name + name = literalize(name) if name num = 0 child = nil @element.find { |child| @@ -1016,13 +1016,13 @@ module REXML # doc.root.attributes['x:foo'] = nil def []=( name, value ) if value.nil? # Delete the named attribute - attr = get_attribute name + attr = get_attribute(name) delete attr return end value = Attribute.new(name, value) unless value.kind_of? Attribute value.element = @element - old_attr = fetch value.name, nil + old_attr = fetch(value.name, nil) if old_attr.nil? store(value.name, value) elsif old_attr.kind_of? Hash @@ -1104,7 +1104,7 @@ module REXML prefix, name = $1, $2 prefix = '' unless prefix end - old = fetch name, nil + old = fetch(name, nil) attr = nil if old.kind_of? Hash # the supplied attribute is one of many attr = old.delete(prefix) diff --git a/lib/rexml/light/node.rb b/lib/rexml/light/node.rb index 9dafd687dd..ff8cb987f0 100644 --- a/lib/rexml/light/node.rb +++ b/lib/rexml/light/node.rb @@ -135,8 +135,8 @@ module REXML end def text=( foo ) - replace = at(4).kind_of? String ? 1 : 0 - self._old_put(4,replace, normalizefoo) + replace = at(4).kind_of?(String) ? 1 : 0 + _old_put(4, replace, normalizefoo) end def root diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb index 915b6efc27..8161750694 100644 --- a/lib/rexml/source.rb +++ b/lib/rexml/source.rb @@ -102,7 +102,7 @@ module REXML # @return the current line in the source def current_line lines = @orig.split - res = lines.grep @buffer[0..30] + res = lines.grep(@buffer[0..30]) res = res[-1] if res.kind_of? Array lines.index( res ) if res end diff --git a/lib/rexml/text.rb b/lib/rexml/text.rb index 906f4d41fc..0614e51d47 100644 --- a/lib/rexml/text.rb +++ b/lib/rexml/text.rb @@ -245,7 +245,7 @@ module REXML def Text::unnormalize( string, doctype=nil, filter=nil, illegal=nil ) rv = string.clone rv.gsub!( /\r\n?/, "\n" ) - matches = rv.scan REFERENCE + matches = rv.scan(REFERENCE) return rv if matches.size == 0 rv.gsub!( NUMERICENTITY ) {|m| m=$1 -- cgit v1.2.3