Skip to content

Commit 68d8dde

Browse files
authored
Merge pull request #1880 from ksss/digest-raap
Retry Refine Digest
2 parents faca316 + ce025b6 commit 68d8dde

File tree

10 files changed

+123
-869
lines changed

10 files changed

+123
-869
lines changed

Rakefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ task :typecheck_test => :compile do
106106
end
107107

108108
task :raap => :compile do
109-
sh %q[cat test/raap.txt | egrep -v '^#|^$' | xargs bundle exec raap]
109+
sh %q[ruby test/raap.rb | xargs bundle exec raap -r digest/bubblebabble --library digest --allow-private]
110110
end
111111

112112
task :rubocop do

stdlib/digest/0/digest.rbs

Lines changed: 22 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ module Digest
7474
# -->
7575
# Returns a BubbleBabble encoded version of a given *string*.
7676
#
77-
def self.bubblebabble: (String) -> String
77+
def self.bubblebabble: (string) -> String
7878

7979
def self.const_missing: (Symbol name) -> singleton(::Digest::Base)
8080

@@ -84,13 +84,13 @@ module Digest
8484
# -->
8585
# Generates a hex-encoded version of a given *string*.
8686
#
87-
def self.hexencode: (String) -> String
87+
def self.hexencode: (string) -> String
8888

8989
private
9090

91-
def bubblebabble: (String) -> String
91+
def bubblebabble: (string) -> String
9292

93-
def hexencode: (String) -> String
93+
def hexencode: (string) -> String
9494
end
9595

9696
# <!-- rdoc-file=ext/digest/lib/digest.rb -->
@@ -111,7 +111,7 @@ module Digest::Instance
111111
# The update() method and the left-shift operator are overridden by each
112112
# implementation subclass. (One should be an alias for the other)
113113
#
114-
def <<: (String) -> self
114+
def <<: (string) -> self
115115

116116
# <!--
117117
# rdoc-file=ext/digest/digest.c
@@ -122,7 +122,7 @@ module Digest::Instance
122122
# of the digest object. If another digest instance is given, checks whether
123123
# they have the same hash value. Otherwise returns false.
124124
#
125-
def ==: (::Digest::Instance | String) -> bool
125+
def ==: (instance | string) -> bool
126126

127127
# <!--
128128
# rdoc-file=ext/digest/lib/digest.rb
@@ -138,7 +138,7 @@ module Digest::Instance
138138
# In either case, the return value is properly padded with '=' and contains no
139139
# line feeds.
140140
#
141-
def base64digest: (?String? str) -> String
141+
def base64digest: (?string? str) -> String
142142

143143
# <!--
144144
# rdoc-file=ext/digest/lib/digest.rb
@@ -177,7 +177,7 @@ module Digest::Instance
177177
# If a *string* is given, returns the hash value for the given *string*,
178178
# resetting the digest to the initial state before and after the process.
179179
#
180-
def digest: (?String) -> String
180+
def digest: (?string) -> String
181181

182182
# <!--
183183
# rdoc-file=ext/digest/digest.c
@@ -204,7 +204,7 @@ module Digest::Instance
204204
# -->
205205
# Updates the digest with the contents of a given file *name* and returns self.
206206
#
207-
def file: (String name) -> self
207+
def file: (string name) -> instance
208208

209209
# <!--
210210
# rdoc-file=ext/digest/digest.c
@@ -218,7 +218,7 @@ module Digest::Instance
218218
# hex-encoded form, resetting the digest to the initial state before and after
219219
# the process.
220220
#
221-
def hexdigest: (?String) -> String
221+
def hexdigest: (?string) -> String
222222

223223
# <!--
224224
# rdoc-file=ext/digest/digest.c
@@ -253,7 +253,7 @@ module Digest::Instance
253253
# Returns a new, initialized copy of the digest object. Equivalent to
254254
# digest_obj.clone().reset().
255255
#
256-
def new: () -> ::Digest::Base
256+
def new: () -> instance
257257

258258
# <!--
259259
# rdoc-file=ext/digest/digest.c
@@ -288,7 +288,7 @@ module Digest::Instance
288288
# The update() method and the left-shift operator are overridden by each
289289
# implementation subclass. (One should be an alias for the other)
290290
#
291-
def update: (String) -> self
291+
def update: (string) -> self
292292

293293
private
294294

@@ -319,15 +319,15 @@ class Digest::Class
319319
# Returns the base64 encoded hash value of a given *string*. The return value
320320
# is properly padded with '=' and contains no line feeds.
321321
#
322-
def self.base64digest: (String str, *untyped) -> String
322+
def self.base64digest: (string str) -> String
323323

324324
# <!--
325325
# rdoc-file=ext/digest/bubblebabble/bubblebabble.c
326326
# - Digest::Class.bubblebabble(string, ...) -> hash_string
327327
# -->
328328
# Returns the BubbleBabble encoded hash value of a given *string*.
329329
#
330-
def self.bubblebabble: (String, *untyped) -> String
330+
def self.bubblebabble: (string) -> String
331331

332332
# <!--
333333
# rdoc-file=ext/digest/digest.c
@@ -338,7 +338,7 @@ class Digest::Class
338338
# any, are passed through to the constructor and the *string* is passed to
339339
# #digest().
340340
#
341-
def self.digest: (String, *untyped) -> String
341+
def self.digest: (string) -> String
342342

343343
# <!--
344344
# rdoc-file=ext/digest/lib/digest.rb
@@ -350,7 +350,7 @@ class Digest::Class
350350
# p Digest::SHA256.file("X11R6.8.2-src.tar.bz2").hexdigest
351351
# # => "f02e3c85572dc9ad7cb77c2a638e3be24cc1b5bea9fdbb0b0299c9668475c534"
352352
#
353-
def self.file: (String name, *untyped) -> ::Digest::Class
353+
def self.file: (string name) -> instance
354354

355355
# <!--
356356
# rdoc-file=ext/digest/digest.c
@@ -359,11 +359,11 @@ class Digest::Class
359359
# Returns the hex-encoded hash value of a given *string*. This is almost
360360
# equivalent to Digest.hexencode(Digest::Class.new(*parameters).digest(string)).
361361
#
362-
def self.hexdigest: (String, *untyped) -> String
362+
def self.hexdigest: (string) -> String
363363

364364
private
365365

366-
def initialize: () -> self
366+
def initialize: () -> void
367367
end
368368

369369
# <!-- rdoc-file=ext/digest/digest.c -->
@@ -408,7 +408,7 @@ class Digest::Base < Digest::Class
408408
# <!-- rdoc-file=ext/digest/digest.c -->
409409
# Update the digest using given *string* and return `self`.
410410
#
411-
def <<: (String) -> self
411+
def <<: (string) -> self
412412

413413
# <!--
414414
# rdoc-file=ext/digest/digest.c
@@ -434,20 +434,14 @@ class Digest::Base < Digest::Class
434434
#
435435
def reset: () -> self
436436

437-
# <!--
438-
# rdoc-file=ext/digest/digest.c
439-
# - digest_base.update(string) -> digest_base
440-
# - digest_base << string -> digest_base
441-
# -->
442-
# Update the digest using given *string* and return `self`.
443-
#
444-
def update: (String) -> self
437+
%a{annotate:rdoc:skip}
438+
alias update <<
445439

446440
private
447441

448442
def finish: () -> String
449443

450-
def initialize_copy: (::Digest::Base) -> self
444+
def initialize_copy: (self) -> self
451445
end
452446

453447
# <!-- rdoc-file=ext/digest/sha1/sha1init.c -->

test/raap.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Specify the class/module and method names to be executed by RaaP.
2+
# By prefixing with `!`, you can skip testing a method.
3+
4+
puts 'Set[Integer]'
5+
puts 'Enumerable[Integer]#to_set'
6+
7+
%w[
8+
MD5
9+
SHA1
10+
RMD160
11+
SHA256
12+
SHA384
13+
SHA512
14+
].each do |klass|
15+
%w[
16+
base64digest
17+
bubblebabble
18+
digest
19+
hexdigest
20+
].each do |singleton_method|
21+
puts "Digest::#{klass}.#{singleton_method}"
22+
end
23+
24+
%w[
25+
<<
26+
==
27+
block_length
28+
digest_length
29+
reset
30+
update
31+
base64digest
32+
base64digest!
33+
block_length
34+
bubblebabble
35+
digest
36+
digest!
37+
digest_length
38+
hexdigest
39+
hexdigest!
40+
inspect
41+
length
42+
new
43+
reset
44+
size
45+
to_s
46+
update
47+
finish
48+
initialize_copy
49+
].each do |instance_method|
50+
puts "Digest::#{klass}##{instance_method}"
51+
end
52+
end

test/raap.txt

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)