diff --git a/lib/benchmark.rb b/lib/benchmark.rb
index 8e7f778..d251fc7 100644
--- a/lib/benchmark.rb
+++ b/lib/benchmark.rb
@@ -558,16 +558,16 @@ if __FILE__ == $0
n = ARGV[0].to_i.nonzero? || 50000
puts %Q([#{n} times iterations of `a = "1"'])
benchmark(" " + CAPTION, 7, FMTSTR) do |x|
- x.report("for:") {for i in 1..n; a = "1"; end} # Benchmark::measure
- x.report("times:") {n.times do ; a = "1"; end}
- x.report("upto:") {1.upto(n) do ; a = "1"; end}
+ x.report("for:") {for _ in 1..n; _ = "1"; end} # Benchmark::measure
+ x.report("times:") {n.times do ; _ = "1"; end}
+ x.report("upto:") {1.upto(n) do ; _ = "1"; end}
end
benchmark do
[
- measure{for i in 1..n; a = "1"; end}, # Benchmark::measure
- measure{n.times do ; a = "1"; end},
- measure{1.upto(n) do ; a = "1"; end}
+ measure{for _ in 1..n; _ = "1"; end}, # Benchmark::measure
+ measure{n.times do ; _ = "1"; end},
+ measure{1.upto(n) do ; _ = "1"; end}
]
end
end
diff --git a/lib/drb/ssl.rb b/lib/drb/ssl.rb
index 08f97f4..2abed5d 100644
--- a/lib/drb/ssl.rb
+++ b/lib/drb/ssl.rb
@@ -122,7 +122,7 @@ module DRb
end
def self.open(uri, config)
- host, port, option = parse_uri(uri)
+ host, port, = parse_uri(uri)
host.untaint
port.untaint
soc = TCPSocket.open(host, port)
@@ -134,7 +134,7 @@ module DRb
def self.open_server(uri, config)
uri = 'drbssl://:0' unless uri
- host, port, opt = parse_uri(uri)
+ host, port, = parse_uri(uri)
if host.size == 0
host = getservername
soc = open_server_inaddr_any(host, port)
diff --git a/lib/drb/timeridconv.rb b/lib/drb/timeridconv.rb
index 6d8935b..7a4a097 100644
--- a/lib/drb/timeridconv.rb
+++ b/lib/drb/timeridconv.rb
@@ -64,7 +64,7 @@ module DRb
def keeper
Thread.new do
loop do
- size = alternate
+ alternate
sleep(@timeout)
end
end
diff --git a/lib/drb/unix.rb b/lib/drb/unix.rb
index ebecc22..a377dd9 100644
--- a/lib/drb/unix.rb
+++ b/lib/drb/unix.rb
@@ -19,14 +19,14 @@ module DRb
end
def self.open(uri, config)
- filename, option = parse_uri(uri)
+ filename, = parse_uri(uri)
filename.untaint
soc = UNIXSocket.open(filename)
self.new(uri, soc, config)
end
def self.open_server(uri, config)
- filename, option = parse_uri(uri)
+ filename, = parse_uri(uri)
if filename.size == 0
soc = temp_server
filename = soc.path
diff --git a/lib/irb/ext/multi-irb.rb b/lib/irb/ext/multi-irb.rb
index 0152d38..a8475b7 100644
--- a/lib/irb/ext/multi-irb.rb
+++ b/lib/irb/ext/multi-irb.rb
@@ -29,12 +29,12 @@ module IRB
end
def thread(key)
- th, irb = search(key)
+ th, = search(key)
th
end
def irb(key)
- th, irb = search(key)
+ _, irb = search(key)
irb
end
@@ -62,7 +62,7 @@ module IRB
def kill(*keys)
for key in keys
- th, irb = search(key)
+ th, _ = search(key)
IRB.fail IrbAlreadyDead unless th.alive?
th.exit
end
diff --git a/lib/irb/ws-for-case-2.rb b/lib/irb/ws-for-case-2.rb
index bb3932a..9f3af49 100644
--- a/lib/irb/ws-for-case-2.rb
+++ b/lib/irb/ws-for-case-2.rb
@@ -10,5 +10,5 @@
#
while true
- IRB::BINDING_QUEUE.push b = binding
+ IRB::BINDING_QUEUE.push _ = binding
end
diff --git a/lib/minitest/mock.rb b/lib/minitest/mock.rb
index ed44164..c616fdd 100644
--- a/lib/minitest/mock.rb
+++ b/lib/minitest/mock.rb
@@ -14,7 +14,7 @@ module MiniTest
end
def expect(name, retval, args=[])
- n, r, a = name, retval, args # for the closure below
+ n, r, = name, retval, args # for the closure below
@expected_calls[name] = { :retval => retval, :args => args }
self.class.__send__ :remove_method, name if respond_to? name
self.class.__send__(:define_method, name) { |*x|
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index f393a15..4ed2517 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -322,7 +322,7 @@ module Net
sock = TCPServer.open(@sock.addr[3], 0)
port = sock.addr[1]
host = sock.addr[3]
- resp = sendport(host, port)
+ sendport(host, port)
return sock
end
private :makeport
diff --git a/lib/net/http.rb b/lib/net/http.rb
index 920301f..4830023 100644
--- a/lib/net/http.rb
+++ b/lib/net/http.rb
@@ -1563,7 +1563,7 @@ module Net #:nodoc:
# or sub-type is not given (e.g. "Content-Type: text").
def sub_type
return nil unless @header['content-type']
- main, sub = *self['Content-Type'].split(';').first.to_s.split('/')
+ _, sub = *self['Content-Type'].split(';').first.to_s.split('/')
return nil unless sub
sub.strip
end
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 3404700..a6831e2 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -2680,7 +2680,6 @@ module Net
token = match(T_ATOM)
name = token.value.upcase
match(T_SPACE)
- mailbox = astring
data = []
token = lookahead
if token.symbol == T_SPACE
diff --git a/lib/open-uri.rb b/lib/open-uri.rb
index bb45d63..512beea 100644
--- a/lib/open-uri.rb
+++ b/lib/open-uri.rb
@@ -126,7 +126,7 @@ module OpenURI
def OpenURI.open_uri(name, *rest) # :nodoc:
uri = URI::Generic === name ? name : URI.parse(name)
- mode, perm, rest = OpenURI.scan_open_optional_arguments(*rest)
+ mode, _, rest = OpenURI.scan_open_optional_arguments(*rest)
options = rest.shift if !rest.empty? && Hash === rest.first
raise ArgumentError.new("extra arguments") if !rest.empty?
options ||= {}
@@ -480,7 +480,7 @@ module OpenURI
# It is downcased for canonicalization.
# Content-Type parameters are stripped.
def content_type
- type, *parameters = content_type_parse
+ type, = content_type_parse
type || 'application/octet-stream'
end
@@ -712,7 +712,7 @@ module URI
when 0 # no proxy setting anyway.
proxy_uri = nil
when 1
- k, v = pairs.shift
+ k, = pairs.shift
if k == 'http_proxy' && ENV[k.upcase] == nil
# http_proxy is safe to use because ENV is case sensitive.
proxy_uri = ENV[name]
diff --git a/lib/optparse.rb b/lib/optparse.rb
index b07d91e..4f631fb 100644
--- a/lib/optparse.rb
+++ b/lib/optparse.rb
@@ -1072,7 +1072,7 @@ class OptionParser
default_style = Switch::NoArgument
default_pattern = nil
klass = nil
- n, q, a = nil
+ q, a = nil
opts.each do |o|
# argument class
diff --git a/lib/racc/parser.rb b/lib/racc/parser.rb
index 9b7a76b..84cd0f6 100644
--- a/lib/racc/parser.rb
+++ b/lib/racc/parser.rb
@@ -105,13 +105,12 @@ module Racc
def _racc_do_parse_rb(arg, in_debug)
action_table, action_check, action_default, action_pointer,
- goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ _, _, _, _,
+ _, _, token_table, _,
+ _, _, * = arg
_racc_init_sysvars
tok = act = i = nil
- nerr = 0
catch(:racc_end_parse) {
while true
@@ -154,14 +153,13 @@ module Racc
def _racc_yyparse_rb(recv, mid, arg, c_debug)
action_table, action_check, action_default, action_pointer,
- goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ _, _, _, _,
+ _, _, token_table, _,
+ _, _, * = arg
_racc_init_sysvars
act = nil
i = nil
- nerr = 0
catch(:racc_end_parse) {
until i = action_pointer[@racc_state[-1]]
@@ -210,10 +208,10 @@ module Racc
###
def _racc_evalact(act, arg)
- action_table, action_check, action_default, action_pointer,
- goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ action_table, action_check, _, action_pointer,
+ _, _, _, _,
+ _, _, _, shift_n, reduce_n,
+ _, * = arg
nerr = 0 # tmp
if act > 0 and act < shift_n
@@ -305,10 +303,10 @@ module Racc
end
def _racc_do_reduce(arg, act)
- action_table, action_check, action_default, action_pointer,
+ _, _, _, _,
goto_table, goto_check, goto_default, goto_pointer,
- nt_base, reduce_table, token_table, shift_n,
- reduce_n, use_result, * = arg
+ nt_base, reduce_table, _, _,
+ _, use_result, * = arg
state = @racc_state
vstack = @racc_vstack
tstack = @racc_tstack
diff --git a/lib/rake.rb b/lib/rake.rb
index b46b196..e597db5 100644
--- a/lib/rake.rb
+++ b/lib/rake.rb
@@ -1038,7 +1038,7 @@ module FileUtils
else
begin
ln(*args)
- rescue StandardError, NotImplementedError => ex
+ rescue StandardError, NotImplementedError
LN_SUPPORTED[0] = false
cp(*args)
end
@@ -1687,7 +1687,7 @@ module Rake
end
def create_rule(*args, &block)
- pattern, arg_names, deps = resolve_args(args)
+ pattern, _, deps = resolve_args(args)
pattern = Regexp.new(Regexp.quote(pattern) + '$') if String === pattern
@rules << [pattern, deps, block]
end
@@ -1795,7 +1795,7 @@ module Rake
fail Rake::RuleRecursionOverflowError,
"Rule Recursion Too Deep" if level >= 16
@rules.each do |pattern, extensions, block|
- if md = pattern.match(task_name)
+ if pattern.match(task_name)
task = attempt_rule(task_name, extensions, block, level)
return task if task
end
@@ -2245,7 +2245,7 @@ module Rake
rescue LoadError => ex
begin
rake_require value
- rescue LoadError => ex2
+ rescue LoadError
raise ex
end
end
diff --git a/lib/rake/contrib/ftptools.rb b/lib/rake/contrib/ftptools.rb
index 4c6897f..12e4ff2 100644
--- a/lib/rake/contrib/ftptools.rb
+++ b/lib/rake/contrib/ftptools.rb
@@ -23,7 +23,7 @@ module Rake # :nodoc:
def initialize(path, entry)
@path = path
- @mode, line, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
+ @mode, _, @owner, @group, size, d1, d2, d3, @name = entry.split(' ')
@size = size.to_i
@time = determine_time(d1, d2, d3)
end
@@ -57,7 +57,6 @@ module Rake # :nodoc:
def determine_time(d1, d2, d3)
now = self.class.time.now
if /:/ =~ d3
- h, m = d3.split(':')
result = Time.parse("#{d1} #{d2} #{now.year} #{d3}")
if result > now
result = Time.parse("#{d1} #{d2} #{now.year-1} #{d3}")
diff --git a/lib/rdoc/markup/attribute_manager.rb b/lib/rdoc/markup/attribute_manager.rb
index 5b9e070..95733b0 100644
--- a/lib/rdoc/markup/attribute_manager.rb
+++ b/lib/rdoc/markup/attribute_manager.rb
@@ -265,7 +265,6 @@ class RDoc::Markup::AttributeManager
def split_into_flow
res = []
current_attr = 0
- str = ""
str_len = @str.length
diff --git a/lib/rdoc/markup/parser.rb b/lib/rdoc/markup/parser.rb
index c214f74..9fba69d 100644
--- a/lib/rdoc/markup/parser.rb
+++ b/lib/rdoc/markup/parser.rb
@@ -387,7 +387,7 @@ class RDoc::Markup::Parser
# Skips a token of +token_type+, optionally raising an error.
def skip token_type, error = true
- type, data, = get
+ type, = get
return unless type # end of stream
diff --git a/lib/rdoc/parser/c.rb b/lib/rdoc/parser/c.rb
index f30167a..e218298 100644
--- a/lib/rdoc/parser/c.rb
+++ b/lib/rdoc/parser/c.rb
@@ -284,7 +284,6 @@ class RDoc::Parser::C < RDoc::Parser
\s*(\([^)]*\))([^;]|$))"xm
comment = $1
body_text = $2
- params = $3
remove_private_comments comment if comment
@@ -304,7 +303,6 @@ class RDoc::Parser::C < RDoc::Parser
find_modifiers comment, meth_obj if comment
- #meth_obj.params = params
meth_obj.start_collecting_tokens
tk = RDoc::RubyToken::Token.new nil, 1, 1
tk.set_text body_text
diff --git a/lib/rdoc/parser/ruby.rb b/lib/rdoc/parser/ruby.rb
index 1876c33..e8de641 100644
--- a/lib/rdoc/parser/ruby.rb
+++ b/lib/rdoc/parser/ruby.rb
@@ -452,7 +452,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
def parse_attr_accessor(context, single, tk, comment)
args = parse_symbol_arg
- read = get_tkread
rw = "?"
# TODO If nodoc is given, don't document any of them
@@ -758,7 +757,6 @@ class RDoc::Parser::Ruby < RDoc::Parser
def parse_meta_attr(context, single, tk, comment)
args = parse_symbol_arg
- read = get_tkread
rw = "?"
# If nodoc is given, don't document any of them
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index 3c08b5e..8771b40 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -383,8 +383,6 @@ The internal error was:
@generator = gen_klass.for @options
- pwd = Dir.pwd
-
Dir.chdir @options.op_dir do
begin
self.class.current = self
diff --git a/lib/rdoc/ruby_lex.rb b/lib/rdoc/ruby_lex.rb
index ab5f32b..fe289fb 100644
--- a/lib/rdoc/ruby_lex.rb
+++ b/lib/rdoc/ruby_lex.rb
@@ -674,7 +674,7 @@ class RDoc::RubyLex
tk_c = TkLPAREN
end
@indent_stack.push tk_c
- tk = Token(tk_c)
+ Token(tk_c)
end
@OP.def_rule("[]", proc{|op, io| @lex_state == EXPR_FNAME}) do
diff --git a/lib/resolv-replace.rb b/lib/resolv-replace.rb
index b63eae8..ff34f90 100644
--- a/lib/resolv-replace.rb
+++ b/lib/resolv-replace.rb
@@ -51,7 +51,6 @@ class UDPSocket < IPSocket
rescue Resolv::ResolvError
raise SocketError, "Hostname not known: #{host}"
end
- err = nil
addrs[0...-1].each {|addr|
begin
return original_resolv_send(mesg, flags, addr, port)
diff --git a/lib/rexml/attribute.rb b/lib/rexml/attribute.rb
index 28a5923..e999279 100644
--- a/lib/rexml/attribute.rb
+++ b/lib/rexml/attribute.rb
@@ -115,7 +115,7 @@ module REXML
def doctype
if @element
doc = @element.document
- doctype = doc.doctype if doc
+ doc.doctype if doc
end
end
diff --git a/lib/rexml/child.rb b/lib/rexml/child.rb
index fd59d72..de84a31 100644
--- a/lib/rexml/child.rb
+++ b/lib/rexml/child.rb
@@ -88,7 +88,7 @@ module REXML
# This doesn't yet handle encodings
def bytes
- encoding = document.encoding
+ document.encoding
to_s
end
diff --git a/lib/rexml/doctype.rb b/lib/rexml/doctype.rb
index 1a946a1..678095a 100644
--- a/lib/rexml/doctype.rb
+++ b/lib/rexml/doctype.rb
@@ -115,7 +115,6 @@ module REXML
output << " #{@long_name.inspect}" if @long_name
output << " #{@uri.inspect}" if @uri
unless @children.empty?
- next_indent = indent + 1
output << ' ['
@children.each { |child|
output << "\n"
diff --git a/lib/rexml/element.rb b/lib/rexml/element.rb
index f999b0b..97fbd06 100644
--- a/lib/rexml/element.rb
+++ b/lib/rexml/element.rb
@@ -874,7 +874,6 @@ module REXML
# a.elements.add(Element.new('b')) #->
# a.elements.add('c') #->
def add element=nil
- rv = nil
if element.nil?
Element.new("", self, @element.context)
elsif not element.kind_of?(Element)
@@ -1092,7 +1091,7 @@ module REXML
delete attr
return
end
- element_document = @element.document
+
unless value.kind_of? Attribute
if @element.document and @element.document.doctype
value = Text::normalize( value, @element.document.doctype )
@@ -1197,7 +1196,7 @@ module REXML
return @element
else # the supplied attribute is a top-level one
attr = old
- res = super(name)
+ super(name)
end
@element
end
diff --git a/lib/rexml/formatters/transitive.rb b/lib/rexml/formatters/transitive.rb
index 3a52e03..6cc690d 100644
--- a/lib/rexml/formatters/transitive.rb
+++ b/lib/rexml/formatters/transitive.rb
@@ -37,7 +37,6 @@ module REXML
# If compact and all children are text, and if the formatted output
# is less than the specified width, then try to print everything on
# one line
- skip = false
@level += @indentation
node.children.each { |child|
write( child, output )
diff --git a/lib/rexml/functions.rb b/lib/rexml/functions.rb
index 2d30e5f..7a05d0c 100644
--- a/lib/rexml/functions.rb
+++ b/lib/rexml/functions.rb
@@ -170,7 +170,6 @@ module REXML
# Kouhei fixed this too
def Functions::substring_after( string, test )
ruby_string = string(string)
- test_string = string(test)
return $1 if ruby_string =~ /#{test}(.*)/
""
end
diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb
index d0f0c51..1e69e14 100644
--- a/lib/rexml/parsers/sax2parser.rb
+++ b/lib/rexml/parsers/sax2parser.rb
@@ -87,7 +87,7 @@ module REXML
@listeners.each { |sym,match,block|
block.start_document if sym == :start_document or sym.nil?
}
- root = context = []
+ context = []
while true
event = @parser.pull
case event[0]
diff --git a/lib/rexml/parsers/xpathparser.rb b/lib/rexml/parsers/xpathparser.rb
index 2db37a2..780e312 100644
--- a/lib/rexml/parsers/xpathparser.rb
+++ b/lib/rexml/parsers/xpathparser.rb
@@ -282,7 +282,6 @@ module REXML
PI = /^processing-instruction\(/
def NodeTest path, parsed
#puts "NodeTest with #{path}"
- res = nil
case path
when /^\*/
path = $'
@@ -578,7 +577,6 @@ module REXML
NUMBER = /^(\d*\.?\d+)/
NT = /^comment|text|processing-instruction|node$/
def PrimaryExpr path, parsed
- arry = []
case path
when VARIABLE_REFERENCE
varname = $1
diff --git a/lib/rexml/quickpath.rb b/lib/rexml/quickpath.rb
index 3ad8023..06cb4f9 100644
--- a/lib/rexml/quickpath.rb
+++ b/lib/rexml/quickpath.rb
@@ -33,7 +33,6 @@ module REXML
results = filter(element.to_a, path)
when /^[\[!\w:]/u
# match on child
- matches = []
children = element.to_a
results = filter(children, path)
else
@@ -51,8 +50,6 @@ module REXML
when /^\/\//u # Descendant
return axe( elements, "descendant-or-self", $' )
when /^\/?\b(\w[-\w]*)\b::/u # Axe
- axe_name = $1
- rest = $'
return axe( elements, $1, $' )
when /^\/(?=\b([:!\w][-\.\w]*:)?[-!\*\.\w]*\b([^:(]|$)|\*)/u # Child
rest = $'
diff --git a/lib/rexml/validation/validation.rb b/lib/rexml/validation/validation.rb
index f0ffa78..8042e5d 100644
--- a/lib/rexml/validation/validation.rb
+++ b/lib/rexml/validation/validation.rb
@@ -33,7 +33,7 @@ module REXML
sattr = [:start_attribute, nil]
eattr = [:end_attribute]
text = [:text, nil]
- k,v = event[2].find { |key,value|
+ k, = event[2].find { |key,value|
sattr[1] = key
#puts "Looking for #{sattr.inspect}"
m = @current.next( sattr )
diff --git a/lib/rexml/xpath_parser.rb b/lib/rexml/xpath_parser.rb
index 11950ec..b0cab10 100644
--- a/lib/rexml/xpath_parser.rb
+++ b/lib/rexml/xpath_parser.rb
@@ -686,7 +686,7 @@ module REXML
return rv
else
res = []
- enum = SyncEnumerator.new( set1, set2 ).each { |i1, i2|
+ SyncEnumerator.new( set1, set2 ).each { |i1, i2|
#puts "i1 = #{i1.inspect} (#{i1.class.name})"
#puts "i2 = #{i2.inspect} (#{i2.class.name})"
i1 = norm( i1 )
diff --git a/lib/rinda/ring.rb b/lib/rinda/ring.rb
index b25fd99..3b59b43 100644
--- a/lib/rinda/ring.rb
+++ b/lib/rinda/ring.rb
@@ -198,7 +198,7 @@ module Rinda
def lookup_ring_any(timeout=5)
queue = Queue.new
- th = Thread.new do
+ Thread.new do
self.lookup_ring(timeout) do |ts|
queue.push(ts)
end
@@ -252,7 +252,7 @@ if __FILE__ == $0
when 's'
require 'rinda/tuplespace'
ts = Rinda::TupleSpace.new
- place = Rinda::RingServer.new(ts)
+ Rinda::RingServer.new(ts)
$stdin.gets
when 'w'
finger = Rinda::RingFinger.new(nil)
diff --git a/lib/rss/atom.rb b/lib/rss/atom.rb
index ff8ff22..7720f77 100644
--- a/lib/rss/atom.rb
+++ b/lib/rss/atom.rb
@@ -527,7 +527,7 @@ module RSS
return false unless inline_other?
return false if inline_other_xml?
- media_type, subtype = mime_split
+ media_type, = mime_split
return true if "text" == media_type.downcase
false
end
diff --git a/lib/rss/maker/0.9.rb b/lib/rss/maker/0.9.rb
index aede4d7..c398343 100644
--- a/lib/rss/maker/0.9.rb
+++ b/lib/rss/maker/0.9.rb
@@ -24,7 +24,7 @@ module RSS
class Channel < ChannelBase
def to_feed(rss)
channel = Rss::Channel.new
- set = setup_values(channel)
+ setup_values(channel)
_not_set_required_variables = not_set_required_variables
if _not_set_required_variables.empty?
rss.channel = channel
@@ -257,7 +257,7 @@ module RSS
class Item < ItemBase
def to_feed(rss)
item = Rss::Channel::Item.new
- set = setup_values(item)
+ setup_values(item)
_not_set_required_variables = not_set_required_variables
if _not_set_required_variables.empty?
rss.items << item
diff --git a/lib/rss/maker/1.0.rb b/lib/rss/maker/1.0.rb
index 0d8075f..1b9f7c3 100644
--- a/lib/rss/maker/1.0.rb
+++ b/lib/rss/maker/1.0.rb
@@ -32,7 +32,7 @@ module RSS
_not_set_required_variables = not_set_required_variables
if _not_set_required_variables.empty?
channel = RDF::Channel.new(@about)
- set = setup_values(channel)
+ setup_values(channel)
channel.dc_dates.clear
rss.channel = channel
set_parent(channel, rss)
diff --git a/lib/rss/maker/dublincore.rb b/lib/rss/maker/dublincore.rb
index 9069c27..717b074 100644
--- a/lib/rss/maker/dublincore.rb
+++ b/lib/rss/maker/dublincore.rb
@@ -11,10 +11,7 @@ module RSS
plural_name ||= "#{name}s"
full_name = "#{RSS::DC_PREFIX}_#{name}"
full_plural_name = "#{RSS::DC_PREFIX}_#{plural_name}"
- klass_name = Utils.to_class_name(name)
plural_klass_name = "DublinCore#{Utils.to_class_name(plural_name)}"
- full_plural_klass_name = "self.class::#{plural_klass_name}"
- full_klass_name = "#{full_plural_klass_name}::#{klass_name}"
klass.def_classed_elements(full_name, "value", plural_klass_name,
full_plural_name, name)
klass.module_eval(<<-EOC, __FILE__, __LINE__ + 1)
diff --git a/lib/rss/rss.rb b/lib/rss/rss.rb
index 6f00804..28d8cce 100644
--- a/lib/rss/rss.rb
+++ b/lib/rss/rss.rb
@@ -1093,9 +1093,8 @@ EOC
tags = tags.sort_by {|x| element_names.index(x) || tags_size}
end
- _tags = tags.dup if tags
models.each_with_index do |model, i|
- name, model_uri, occurs, getter = model
+ name, _, occurs, = model
if DEBUG
p "before"
diff --git a/lib/rubygems/command.rb b/lib/rubygems/command.rb
index 3491937..f3961f1 100644
--- a/lib/rubygems/command.rb
+++ b/lib/rubygems/command.rb
@@ -168,7 +168,7 @@ class Gem::Command
"Please specify at least one gem name (e.g. gem build GEMNAME)"
end
- gem_names = args.select { |arg| arg !~ /^-/ }
+ args.select { |arg| arg !~ /^-/ }
end
##
@@ -430,7 +430,7 @@ class Gem::Command
@parser.separator " #{header}Options:"
option_list.each do |args, handler|
- dashes = args.select { |arg| arg =~ /^-/ }
+ args.select { |arg| arg =~ /^-/ }
@parser.on(*args) do |value|
handler.call(value, @options)
end
diff --git a/lib/rubygems/commands/build_command.rb b/lib/rubygems/commands/build_command.rb
index e1f0122..c1ba9d2 100644
--- a/lib/rubygems/commands/build_command.rb
+++ b/lib/rubygems/commands/build_command.rb
@@ -35,7 +35,7 @@ class Gem::Commands::BuildCommand < Gem::Command
while not f.eof? and spec = Gem::Specification.from_yaml(f)
result << spec
end
- rescue Gem::EndOfYAMLException => e
+ rescue Gem::EndOfYAMLException
# OK
end
end
diff --git a/lib/rubygems/commands/check_command.rb b/lib/rubygems/commands/check_command.rb
index 475aeb3..0bfad9b 100644
--- a/lib/rubygems/commands/check_command.rb
+++ b/lib/rubygems/commands/check_command.rb
@@ -71,7 +71,7 @@ class Gem::Commands::CheckCommand < Gem::Command
say "Verifying gem: '#{gem_name}'"
begin
Gem::Validator.new.verify_gem_file(gem_name)
- rescue Exception => e
+ rescue Exception
alert_error "#{gem_name} is invalid."
end
end
diff --git a/lib/rubygems/commands/query_command.rb b/lib/rubygems/commands/query_command.rb
index 93b4170..65258fd 100644
--- a/lib/rubygems/commands/query_command.rb
+++ b/lib/rubygems/commands/query_command.rb
@@ -161,19 +161,19 @@ class Gem::Commands::QueryCommand < Gem::Command
end
versions.each do |gem_name, matching_tuples|
- matching_tuples = matching_tuples.sort_by do |(name, version,_),_|
+ matching_tuples = matching_tuples.sort_by do |(_, version,_),_|
version
end.reverse
platforms = Hash.new { |h,version| h[version] = [] }
- matching_tuples.map do |(name, version, platform,_),_|
+ matching_tuples.map do |(_, version, platform,_),_|
platforms[version] << platform if platform
end
seen = {}
- matching_tuples.delete_if do |(name, version,_),_|
+ matching_tuples.delete_if do |(_, version,_),_|
if seen[version] then
true
else
@@ -186,7 +186,7 @@ class Gem::Commands::QueryCommand < Gem::Command
if options[:versions] then
list = if platforms.empty? or options[:details] then
- matching_tuples.map { |(name, version,_),_| version }.uniq
+ matching_tuples.map { |(_, version,_),_| version }.uniq
else
platforms.sort.reverse.map do |version, pls|
if pls == [Gem::Platform::RUBY] then
diff --git a/lib/rubygems/commands/server_command.rb b/lib/rubygems/commands/server_command.rb
index 4277787..1760700 100644
--- a/lib/rubygems/commands/server_command.rb
+++ b/lib/rubygems/commands/server_command.rb
@@ -17,7 +17,7 @@ class Gem::Commands::ServerCommand < Gem::Command
else
begin
Socket.getservbyname port
- rescue SocketError => e
+ rescue SocketError
raise OptionParser::InvalidArgument, "#{port}: no such named service"
end
end
diff --git a/lib/rubygems/commands/update_command.rb b/lib/rubygems/commands/update_command.rb
index 45d82e9..2e6f119 100644
--- a/lib/rubygems/commands/update_command.rb
+++ b/lib/rubygems/commands/update_command.rb
@@ -181,11 +181,11 @@ class Gem::Commands::UpdateCommand < Gem::Command
end
end
- matching_gems = spec_tuples.select do |(name, version, platform),|
+ matching_gems = spec_tuples.select do |(name, _, platform),|
name == l_name and Gem::Platform.match platform
end
- highest_remote_gem = matching_gems.sort_by do |(name, version),|
+ highest_remote_gem = matching_gems.sort_by do |(_, version),|
version
end.last
diff --git a/lib/rubygems/doc_manager.rb b/lib/rubygems/doc_manager.rb
index d26d87a..b38fce1 100644
--- a/lib/rubygems/doc_manager.rb
+++ b/lib/rubygems/doc_manager.rb
@@ -77,7 +77,7 @@ class Gem::DocManager
:formatter => RDoc::RI::Formatter,
}
- driver = RDoc::RI::Driver.new(options).class_cache
+ RDoc::RI::Driver.new(options).class_cache
end
##
diff --git a/lib/rubygems/format.rb b/lib/rubygems/format.rb
index 82eaf9e..d4c66d9 100644
--- a/lib/rubygems/format.rb
+++ b/lib/rubygems/format.rb
@@ -32,8 +32,6 @@ class Gem::Format
# representing the data in the gem
def self.from_file_by_path(file_path, security_policy = nil)
- format = nil
-
unless File.exist?(file_path)
raise Gem::Exception, "Cannot load gem at [#{file_path}] in #{Dir.pwd}"
end
diff --git a/lib/rubygems/gem_openssl.rb b/lib/rubygems/gem_openssl.rb
index 7891d59..ade9564 100644
--- a/lib/rubygems/gem_openssl.rb
+++ b/lib/rubygems/gem_openssl.rb
@@ -42,7 +42,7 @@ begin
# Reference a constant defined in the .rb portion of ssl (just to
# make sure that part is loaded too).
- dummy = OpenSSL::Digest::SHA1
+ OpenSSL::Digest::SHA1
Gem.ssl_available = true
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index f64696f..d942960 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -318,7 +318,7 @@ class Gem::Installer
def generate_bin_script(filename, bindir)
bin_script_path = File.join bindir, formatted_program_filename(filename)
- exec_path = File.join @gem_dir, @spec.bindir, filename
+ File.join @gem_dir, @spec.bindir, filename
# HACK some gems don't have #! in their executables, restore 2008/06
#if File.read(exec_path, 2) == '#!' then
@@ -466,7 +466,7 @@ TEXT
say results.join("\n") if Gem.configuration.really_verbose
- rescue => ex
+ rescue
results = results.join "\n"
File.open('gem_make.out', 'wb') { |f| f.puts results }
diff --git a/lib/rubygems/old_format.rb b/lib/rubygems/old_format.rb
index 43967db..4cbff51 100644
--- a/lib/rubygems/old_format.rb
+++ b/lib/rubygems/old_format.rb
@@ -143,7 +143,7 @@ class Gem::OldFormat
end
yield [entry, Zlib::Inflate.inflate(file_data.strip.unpack("m")[0])]
end
- rescue Zlib::DataError => e
+ rescue Zlib::DataError
raise Gem::Exception, errstr
end
end
diff --git a/lib/rubygems/source_index.rb b/lib/rubygems/source_index.rb
index f9b8ea0..c6e7a8b 100644
--- a/lib/rubygems/source_index.rb
+++ b/lib/rubygems/source_index.rb
@@ -357,7 +357,7 @@ class Gem::SourceIndex
begin
fetcher = Gem::SpecFetcher.fetcher
remotes = fetcher.find_matching dependency
- remotes = remotes.map { |(name, version,_),_| version }
+ remotes = remotes.map { |(_, version, _),_| version }
rescue Gem::RemoteFetcher::FetchError => e
raise unless fetcher.warn_legacy e do
require 'rubygems/source_info_cache'
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 4c5a02d..c9a4a0c 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -671,7 +671,7 @@ class Gem::Specification
private :same_attributes?
def hash # :nodoc:
- @@attributes.inject(0) { |hash_code, (name, default_value)|
+ @@attributes.inject(0) { |hash_code, (name, _)|
n = self.send(name).hash
hash_code + n
}
@@ -703,7 +703,7 @@ class Gem::Specification
def to_yaml(opts = {}) # :nodoc:
return super if YAML.const_defined?(:ENGINE) && !YAML::ENGINE.syck?
- yaml = YAML.quick_emit object_id, opts do |out|
+ YAML.quick_emit object_id, opts do |out|
out.map taguri, to_yaml_style do |map|
encode_with map
end
diff --git a/lib/rubygems/uninstaller.rb b/lib/rubygems/uninstaller.rb
index 1dea232..b8feb48 100644
--- a/lib/rubygems/uninstaller.rb
+++ b/lib/rubygems/uninstaller.rb
@@ -82,7 +82,7 @@ class Gem::Uninstaller
gem_names = list.collect {|gem| gem.full_name} + ["All versions"]
say
- gem_name, index = choose_from_list "Select gem to uninstall:", gem_names
+ _, index = choose_from_list "Select gem to uninstall:", gem_names
if index == list.size then
remove_all list.dup
diff --git a/lib/shell/system-command.rb b/lib/shell/system-command.rb
index af9b0a8..ee3490e 100644
--- a/lib/shell/system-command.rb
+++ b/lib/shell/system-command.rb
@@ -84,7 +84,7 @@ class Shell
notify "Job(%id) start imp-pipe.", @shell.debug?
rs = @shell.record_separator unless rs
_eop = true
- th = Thread.start {
+ Thread.start {
begin
while l = @pipe_in.gets
@input_queue.push l
@@ -109,7 +109,7 @@ class Shell
def start_export
notify "job(%id) start exp-pipe.", @shell.debug?
_eop = true
- th = Thread.start{
+ Thread.start{
begin
@input.each do |l|
ProcessController::block_output_synchronize do
diff --git a/lib/sync.rb b/lib/sync.rb
index b97d36e..1477895 100644
--- a/lib/sync.rb
+++ b/lib/sync.rb
@@ -128,9 +128,8 @@ module Sync_m
def sync_try_lock(mode = EX)
return unlock if mode == UN
@sync_mutex.synchronize do
- ret = sync_try_lock_sub(mode)
+ sync_try_lock_sub(mode)
end
- ret
end
def sync_lock(m = EX)
diff --git a/lib/uri/common.rb b/lib/uri/common.rb
index 58fd422..4d48ed8 100644
--- a/lib/uri/common.rb
+++ b/lib/uri/common.rb
@@ -349,7 +349,7 @@ module URI
ret[:REL_URI] = rel_uri = "(?:#{net_path}|#{abs_path}|#{rel_path})(?:\\?#{query})?"
# URI-reference = [ absoluteURI | relativeURI ] [ "#" fragment ]
- ret[:URI_REF] = uri_ref = "(?:#{abs_uri}|#{rel_uri})?(?:##{fragment})?"
+ ret[:URI_REF] = "(?:#{abs_uri}|#{rel_uri})?(?:##{fragment})?"
ret[:X_ABS_URI] = "
(#{scheme}): (?# 1: scheme)
diff --git a/lib/webrick/cgi.rb b/lib/webrick/cgi.rb
index 7099d14..806d050 100644
--- a/lib/webrick/cgi.rb
+++ b/lib/webrick/cgi.rb
@@ -143,7 +143,7 @@ module WEBrick
setup_header
@header_part << CRLF
@header_part.rewind
- rescue Exception => ex
+ rescue Exception
raise CGIError, "invalid CGI environment"
end
end
diff --git a/lib/webrick/httpresponse.rb b/lib/webrick/httpresponse.rb
index 98c4a35..fa1ef41 100644
--- a/lib/webrick/httpresponse.rb
+++ b/lib/webrick/httpresponse.rb
@@ -280,7 +280,7 @@ module WEBrick
if @request_method == "HEAD"
# do nothing
elsif chunked?
- remain = body ? @body.bytesize : 0
+ body ? @body.bytesize : 0
while buf = @body[@sent_size, @buffer_size]
break if buf.empty?
data = ""
diff --git a/lib/webrick/httpservlet/cgi_runner.rb b/lib/webrick/httpservlet/cgi_runner.rb
index dd7325d..32ecb6f 100644
--- a/lib/webrick/httpservlet/cgi_runner.rb
+++ b/lib/webrick/httpservlet/cgi_runner.rb
@@ -20,7 +20,6 @@ end
STDIN.binmode
-buf = ""
len = sysread(STDIN, 8).to_i
out = sysread(STDIN, len)
STDOUT.reopen(open(out, "w"))
@@ -38,7 +37,7 @@ hash.each{|k, v| ENV[k] = v if v }
dir = File::dirname(ENV["SCRIPT_FILENAME"])
Dir::chdir dir
-if interpreter = ARGV[0]
+if ARGV[0]
argv = ARGV.dup
argv << ENV["SCRIPT_FILENAME"]
exec(*argv)
diff --git a/lib/webrick/httpservlet/erbhandler.rb b/lib/webrick/httpservlet/erbhandler.rb
index 845db07..cbd4fb2 100644
--- a/lib/webrick/httpservlet/erbhandler.rb
+++ b/lib/webrick/httpservlet/erbhandler.rb
@@ -44,8 +44,8 @@ module WEBrick
private
def evaluate(erb, servlet_request, servlet_response)
Module.new.module_eval{
- meta_vars = servlet_request.meta_vars
- query = servlet_request.query
+ servlet_request.meta_vars
+ servlet_request.query
erb.result(binding)
}
end
diff --git a/lib/webrick/log.rb b/lib/webrick/log.rb
index 0ffa12d..550f9f5 100644
--- a/lib/webrick/log.rb
+++ b/lib/webrick/log.rb
@@ -60,7 +60,7 @@ module WEBrick
private
def format(arg)
- str = if arg.is_a?(Exception)
+ if arg.is_a?(Exception)
"#{arg.class}: #{arg.message}\n\t" <<
arg.backtrace.join("\n\t") << "\n"
elsif arg.respond_to?(:to_str)
diff --git a/lib/xmlrpc/httpserver.rb b/lib/xmlrpc/httpserver.rb
index 66d5213..a9605ef 100644
--- a/lib/xmlrpc/httpserver.rb
+++ b/lib/xmlrpc/httpserver.rb
@@ -170,7 +170,7 @@ private
io << http_resp(response.status, response.status_message,
response.header, response.body)
- rescue Exception => e
+ rescue Exception
io << http_resp(500, "Internal Server Error")
end
diff --git a/lib/xmlrpc/parser.rb b/lib/xmlrpc/parser.rb
index d8e91b0..840130c 100644
--- a/lib/xmlrpc/parser.rb
+++ b/lib/xmlrpc/parser.rb
@@ -714,7 +714,7 @@ module XMLRPC
end
def parse(str)
- parser = REXML::Document.parse_stream(str, self)
+ REXML::Document.parse_stream(str, self)
end
end