Skip to content

Commit

Permalink
* lib: Convert tabs to spaces for ruby files per
Browse files Browse the repository at this point in the history
	  http://redmine.ruby-lang.org/projects/ruby/wiki/DeveloperHowto#coding-style
	  Patch by Steve Klabnik [Ruby 1.9 - Bug ruby#4730]
	  Patch by Jason Dew [Ruby 1.9 - Feature ruby#4718]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
drbrain committed May 18, 2011
1 parent 3427614 commit 7bbf2f3
Show file tree
Hide file tree
Showing 67 changed files with 3,836 additions and 3,827 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Thu May 19 06:16:41 2011 Eric Hodel <[email protected]>

* 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]

Thu May 19 06:06:07 2011 Eric Hodel <[email protected]>

* lib/cgi/util.rb: Improve documentation. Patch by Clinton Nixon.
Expand Down
22 changes: 11 additions & 11 deletions lib/abbrev.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,24 @@ def abbrev(words, pattern = nil)
seen = Hash.new(0)

if pattern.is_a?(String)
pattern = /^#{Regexp.quote(pattern)}/ # regard as a prefix
pattern = /^#{Regexp.quote(pattern)}/ # regard as a prefix
end

words.each do |word|
next if (abbrev = word).empty?
while (len = abbrev.rindex(/[\w\W]\z/)) > 0
abbrev = word[0,len]
abbrev = word[0,len]

next if pattern && pattern !~ abbrev
next if pattern && pattern !~ abbrev

case seen[abbrev] += 1
when 1
table[abbrev] = word
when 2
table.delete(abbrev)
else
break
end
case seen[abbrev] += 1
when 1
table[abbrev] = word
when 2
table.delete(abbrev)
else
break
end
end
end

Expand Down
24 changes: 12 additions & 12 deletions lib/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ def bmbm(width = 0, &blk) # :yield: job
puts 'Rehearsal '.ljust(width+CAPTION.length,'-')
ets = job.list.inject(Tms.new) { |sum,(label,item)|
print label.ljust(width)
res = Benchmark.measure(&item)
print res.format
sum + res
res = Benchmark.measure(&item)
print res.format
sum + res
}.format("total: %tsec")
print " #{ets}\n\n".rjust(width+CAPTION.length+2,'-')

Expand Down Expand Up @@ -520,14 +520,14 @@ def memberwise(op, x)
cutime.__send__(op, x.cutime),
cstime.__send__(op, x.cstime),
real.__send__(op, x.real)
)
)
else
Benchmark::Tms.new(utime.__send__(op, x),
stime.__send__(op, x),
cutime.__send__(op, x),
cstime.__send__(op, x),
real.__send__(op, x)
)
)
end
end
end
Expand All @@ -548,13 +548,13 @@ def memberwise(op, x)
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
end

benchmark do
[
measure{for _ in 1..n; _ = "1"; end}, # Benchmark.measure
measure{n.times do ; _ = "1"; end},
measure{1.upto(n) do ; _ = "1"; end}
]
benchmark do
[
measure{for _ in 1..n; _ = "1"; end}, # Benchmark.measure
measure{n.times do ; _ = "1"; end},
measure{1.upto(n) do ; _ = "1"; end}
]
end
end
26 changes: 13 additions & 13 deletions lib/cmath.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def exp(z)
else
ere = exp!(z.real)
Complex(ere * cos!(z.imag),
ere * sin!(z.imag))
ere * sin!(z.imag))
end
end

Expand All @@ -71,7 +71,7 @@ def log(*args)
else
a = Complex(log!(z.abs), z.arg)
if b
a /= log(b)
a /= log(b)
end
a
end
Expand Down Expand Up @@ -105,18 +105,18 @@ def log10(z)
def sqrt(z)
if z.real?
if z < 0
Complex(0, sqrt!(-z))
Complex(0, sqrt!(-z))
else
sqrt!(z)
sqrt!(z)
end
else
if z.imag < 0 ||
(z.imag == 0 && z.imag.to_s[0] == '-')
sqrt(z.conjugate).conjugate
(z.imag == 0 && z.imag.to_s[0] == '-')
sqrt(z.conjugate).conjugate
else
r = z.abs
x = z.real
Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
r = z.abs
x = z.real
Complex(sqrt!((r + x) / 2.0), sqrt!((r - x) / 2.0))
end
end
end
Expand All @@ -138,7 +138,7 @@ def sin(z)
sin!(z)
else
Complex(sin!(z.real) * cosh!(z.imag),
cos!(z.real) * sinh!(z.imag))
cos!(z.real) * sinh!(z.imag))
end
end

Expand All @@ -149,7 +149,7 @@ def cos(z)
cos!(z)
else
Complex(cos!(z.real) * cosh!(z.imag),
-sin!(z.real) * sinh!(z.imag))
-sin!(z.real) * sinh!(z.imag))
end
end

Expand All @@ -170,7 +170,7 @@ def sinh(z)
sinh!(z)
else
Complex(sinh!(z.real) * cos!(z.imag),
cosh!(z.real) * sin!(z.imag))
cosh!(z.real) * sin!(z.imag))
end
end

Expand All @@ -181,7 +181,7 @@ def cosh(z)
cosh!(z)
else
Complex(cosh!(z.real) * cos!(z.imag),
sinh!(z.real) * sin!(z.imag))
sinh!(z.real) * sin!(z.imag))
end
end

Expand Down
Loading

0 comments on commit 7bbf2f3

Please sign in to comment.