rbs 0.13.0 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +9 -5
- data/.gitignore +0 -1
- data/CHANGELOG.md +33 -1
- data/Gemfile +4 -0
- data/README.md +9 -3
- data/Rakefile +14 -1
- data/Steepfile +1 -1
- data/bin/annotate-with-rdoc +1 -1
- data/bin/setup +0 -2
- data/bin/test_runner.rb +15 -1
- data/{stdlib/builtin → core}/array.rbs +124 -120
- data/{stdlib/builtin → core}/basic_object.rbs +54 -54
- data/{stdlib/builtin → core}/binding.rbs +42 -42
- data/core/builtin.rbs +70 -0
- data/{stdlib/builtin → core}/class.rbs +33 -33
- data/{stdlib/builtin → core}/comparable.rbs +0 -0
- data/{stdlib/builtin → core}/complex.rbs +90 -90
- data/{stdlib/builtin → core}/constants.rbs +0 -0
- data/{stdlib/builtin → core}/data.rbs +0 -0
- data/{stdlib/builtin → core}/deprecated.rbs +0 -0
- data/{stdlib/builtin → core}/dir.rbs +1 -1
- data/{stdlib/builtin → core}/encoding.rbs +33 -33
- data/{stdlib/builtin → core}/enumerable.rbs +99 -92
- data/{stdlib/builtin → core}/enumerator.rbs +40 -40
- data/{stdlib/builtin → core}/errno.rbs +0 -0
- data/{stdlib/builtin → core}/errors.rbs +2 -2
- data/{stdlib/builtin → core}/exception.rbs +50 -50
- data/{stdlib/builtin → core}/false_class.rbs +6 -6
- data/{stdlib/builtin → core}/fiber.rbs +14 -14
- data/{stdlib/builtin → core}/fiber_error.rbs +1 -1
- data/{stdlib/builtin → core}/file.rbs +0 -0
- data/{stdlib/builtin → core}/file_test.rbs +0 -0
- data/{stdlib/builtin → core}/float.rbs +161 -161
- data/{stdlib/builtin → core}/gc.rbs +3 -3
- data/{stdlib/builtin → core}/hash.rbs +15 -15
- data/{stdlib/builtin → core}/integer.rbs +0 -0
- data/{stdlib/builtin → core}/io.rbs +89 -89
- data/{stdlib/builtin → core}/kernel.rbs +70 -154
- data/{stdlib/builtin → core}/marshal.rbs +0 -0
- data/{stdlib/builtin → core}/match_data.rbs +1 -1
- data/{stdlib/builtin → core}/math.rbs +0 -0
- data/{stdlib/builtin → core}/method.rbs +19 -19
- data/{stdlib/builtin → core}/module.rbs +13 -13
- data/{stdlib/builtin → core}/nil_class.rbs +20 -20
- data/{stdlib/builtin → core}/numeric.rbs +101 -101
- data/{stdlib/builtin → core}/object.rbs +173 -173
- data/{stdlib/builtin → core}/proc.rbs +91 -91
- data/{stdlib/builtin → core}/process.rbs +0 -0
- data/{stdlib/builtin → core}/random.rbs +1 -1
- data/{stdlib/builtin → core}/range.rbs +4 -6
- data/{stdlib/builtin → core}/rational.rbs +83 -83
- data/{stdlib/builtin → core}/rb_config.rbs +0 -0
- data/{stdlib/builtin → core}/regexp.rbs +0 -0
- data/{stdlib/builtin → core}/ruby_vm.rbs +0 -0
- data/{stdlib/builtin → core}/signal.rbs +7 -7
- data/{stdlib/builtin → core}/string.rbs +10 -10
- data/{stdlib/builtin → core}/string_io.rbs +8 -8
- data/{stdlib/builtin → core}/struct.rbs +2 -2
- data/{stdlib/builtin → core}/symbol.rbs +1 -1
- data/{stdlib/builtin → core}/thread.rbs +189 -189
- data/{stdlib/builtin → core}/thread_group.rbs +2 -2
- data/{stdlib/builtin → core}/time.rbs +0 -0
- data/{stdlib/builtin → core}/trace_point.rbs +0 -0
- data/{stdlib/builtin → core}/true_class.rbs +10 -10
- data/{stdlib/builtin → core}/unbound_method.rbs +0 -0
- data/{stdlib/builtin → core}/warning.rbs +1 -1
- data/docs/CONTRIBUTING.md +1 -0
- data/docs/repo.md +125 -0
- data/docs/syntax.md +50 -6
- data/goodcheck.yml +22 -5
- data/lib/rbs.rb +1 -0
- data/lib/rbs/ast/comment.rb +1 -1
- data/lib/rbs/cli.rb +105 -103
- data/lib/rbs/definition.rb +9 -4
- data/lib/rbs/definition_builder.rb +54 -22
- data/lib/rbs/environment.rb +1 -1
- data/lib/rbs/environment_loader.rb +79 -105
- data/lib/rbs/namespace.rb +1 -1
- data/lib/rbs/parser.rb +3153 -0
- data/lib/rbs/parser.y +25 -11
- data/lib/rbs/prototype/rb.rb +47 -9
- data/lib/rbs/prototype/runtime.rb +17 -7
- data/lib/rbs/repository.rb +121 -0
- data/lib/rbs/test/hook.rb +2 -0
- data/lib/rbs/test/setup.rb +5 -3
- data/lib/rbs/test/setup_helper.rb +4 -4
- data/lib/rbs/test/tester.rb +4 -1
- data/lib/rbs/test/type_check.rb +12 -6
- data/lib/rbs/type_name.rb +3 -2
- data/lib/rbs/variance_calculator.rb +1 -1
- data/lib/rbs/vendorer.rb +38 -16
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs/writer.rb +1 -1
- data/sig/cli.rbs +58 -0
- data/sig/constant.rbs +2 -2
- data/sig/constant_table.rbs +11 -11
- data/sig/declarations.rbs +2 -2
- data/sig/definition.rbs +10 -5
- data/sig/definition_builder.rbs +4 -1
- data/sig/environment_loader.rbs +92 -46
- data/sig/members.rbs +2 -2
- data/sig/method_types.rbs +1 -1
- data/sig/namespace.rbs +4 -4
- data/sig/parser.rbs +25 -0
- data/sig/polyfill.rbs +42 -0
- data/sig/rbs.rbs +8 -0
- data/sig/repository.rbs +79 -0
- data/sig/substitution.rbs +3 -3
- data/sig/typename.rbs +1 -1
- data/sig/types.rbs +1 -1
- data/sig/vendorer.rbs +44 -0
- data/sig/writer.rbs +15 -15
- data/stdlib/abbrev/{abbrev.rbs → 0/abbrev.rbs} +0 -0
- data/stdlib/base64/{base64.rbs → 0/base64.rbs} +1 -1
- data/stdlib/benchmark/{benchmark.rbs → 0/benchmark.rbs} +2 -2
- data/stdlib/{bigdecimal/math → bigdecimal-math/0}/big_math.rbs +0 -0
- data/stdlib/bigdecimal/{big_decimal.rbs → 0/big_decimal.rbs} +0 -0
- data/stdlib/coverage/{coverage.rbs → 0/coverage.rbs} +2 -2
- data/stdlib/csv/{csv.rbs → 0/csv.rbs} +4 -4
- data/stdlib/date/{date.rbs → 0/date.rbs} +4 -4
- data/stdlib/date/{date_time.rbs → 0/date_time.rbs} +1 -1
- data/stdlib/dbm/0/dbm.rbs +277 -0
- data/stdlib/erb/{erb.rbs → 0/erb.rbs} +0 -0
- data/stdlib/fiber/{fiber.rbs → 0/fiber.rbs} +0 -0
- data/stdlib/find/{find.rbs → 0/find.rbs} +12 -12
- data/stdlib/forwardable/{forwardable.rbs → 0/forwardable.rbs} +0 -0
- data/stdlib/ipaddr/{ipaddr.rbs → 0/ipaddr.rbs} +0 -0
- data/stdlib/json/{json.rbs → 0/json.rbs} +0 -0
- data/stdlib/logger/{formatter.rbs → 0/formatter.rbs} +0 -0
- data/stdlib/logger/{log_device.rbs → 0/log_device.rbs} +1 -1
- data/stdlib/logger/{logger.rbs → 0/logger.rbs} +1 -1
- data/stdlib/logger/{period.rbs → 0/period.rbs} +0 -0
- data/stdlib/logger/{severity.rbs → 0/severity.rbs} +0 -0
- data/stdlib/mutex_m/{mutex_m.rbs → 0/mutex_m.rbs} +0 -0
- data/stdlib/pathname/{pathname.rbs → 0/pathname.rbs} +40 -40
- data/stdlib/prime/{integer-extension.rbs → 0/integer-extension.rbs} +0 -0
- data/stdlib/prime/{prime.rbs → 0/prime.rbs} +1 -1
- data/stdlib/pstore/0/pstore.rbs +287 -0
- data/stdlib/pty/{pty.rbs → 0/pty.rbs} +1 -1
- data/stdlib/securerandom/{securerandom.rbs → 0/securerandom.rbs} +0 -0
- data/stdlib/set/{set.rbs → 0/set.rbs} +10 -10
- data/stdlib/tmpdir/{tmpdir.rbs → 0/tmpdir.rbs} +12 -12
- data/stdlib/tsort/0/cyclic.rbs +4 -0
- data/stdlib/tsort/0/interfaces.rbs +19 -0
- data/stdlib/tsort/0/tsort.rbs +363 -0
- data/stdlib/uri/{file.rbs → 0/file.rbs} +0 -0
- data/stdlib/uri/{generic.rbs → 0/generic.rbs} +1 -1
- data/stdlib/uri/{http.rbs → 0/http.rbs} +0 -0
- data/stdlib/uri/{https.rbs → 0/https.rbs} +0 -0
- data/stdlib/uri/{ldap.rbs → 0/ldap.rbs} +0 -0
- data/stdlib/uri/{ldaps.rbs → 0/ldaps.rbs} +0 -0
- data/stdlib/zlib/{zlib.rbs → 0/zlib.rbs} +0 -0
- data/steep/Gemfile.lock +9 -9
- metadata +104 -93
- data/stdlib/builtin/builtin.rbs +0 -42
data/sig/members.rbs
CHANGED
@@ -23,7 +23,7 @@ module RBS
|
|
23
23
|
attr_reader comment: Comment?
|
24
24
|
attr_reader overload: bool
|
25
25
|
|
26
|
-
def initialize: (name: Symbol, kind: kind, types: Array[MethodType], annotations: Array[Annotation], location: Location?, comment: Comment?, overload:
|
26
|
+
def initialize: (name: Symbol, kind: kind, types: Array[MethodType], annotations: Array[Annotation], location: Location?, comment: Comment?, overload: boolish) -> void
|
27
27
|
|
28
28
|
include _HashEqual
|
29
29
|
include _ToJson
|
@@ -34,7 +34,7 @@ module RBS
|
|
34
34
|
|
35
35
|
def overload?: () -> bool
|
36
36
|
|
37
|
-
def update: (?name: Symbol, ?kind: kind, ?types: Array[MethodType], ?annotations: Array[Annotation], ?location: Location?, ?comment: Comment?, ?overload:
|
37
|
+
def update: (?name: Symbol, ?kind: kind, ?types: Array[MethodType], ?annotations: Array[Annotation], ?location: Location?, ?comment: Comment?, ?overload: boolish) -> MethodDefinition
|
38
38
|
end
|
39
39
|
|
40
40
|
module Var
|
data/sig/method_types.rbs
CHANGED
data/sig/namespace.rbs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RBS
|
2
2
|
# Namespace instance represents a _prefix of module names_.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# vvvvvvvvvvvvvv TypeName
|
5
5
|
# RBS::Namespace
|
6
6
|
# ^^^^^ Namespace
|
@@ -28,7 +28,7 @@ module RBS
|
|
28
28
|
class Namespace
|
29
29
|
attr_reader path: Array[Symbol]
|
30
30
|
|
31
|
-
def initialize: (path: Array[Symbol], absolute:
|
31
|
+
def initialize: (path: Array[Symbol], absolute: boolish) -> void
|
32
32
|
|
33
33
|
# Returns new _empty_ namespace.
|
34
34
|
def self.empty: () -> Namespace
|
@@ -44,7 +44,7 @@ module RBS
|
|
44
44
|
# If `other` is an absolute namespace, it returns `other`.
|
45
45
|
#
|
46
46
|
# Namespace("Foo::") + Namespace("::Bar::") # => ::Bar::
|
47
|
-
#
|
47
|
+
#
|
48
48
|
def +: (Namespace other) -> Namespace
|
49
49
|
|
50
50
|
# Add one path component to self.
|
@@ -62,7 +62,7 @@ module RBS
|
|
62
62
|
|
63
63
|
# Returns true if self is absolute namespace.
|
64
64
|
def absolute?: () -> bool
|
65
|
-
|
65
|
+
|
66
66
|
# Returns true if self is relative namespace.
|
67
67
|
def relative?: () -> bool
|
68
68
|
|
data/sig/parser.rbs
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module RBS
|
2
|
+
class Parser
|
3
|
+
class SyntaxError < StandardError
|
4
|
+
attr_reader token_str: String
|
5
|
+
attr_reader error_value: untyped
|
6
|
+
attr_reader value_stack: untyped?
|
7
|
+
|
8
|
+
def initialize: (token_str: String, error_value: untyped, ?value_stack: untyped?) -> void
|
9
|
+
end
|
10
|
+
|
11
|
+
class SemanticsError < StandardError
|
12
|
+
attr_reader subject: untyped
|
13
|
+
attr_reader location: Location
|
14
|
+
attr_reader original_message: String
|
15
|
+
|
16
|
+
def initialize: (String message, subject: untyped, location: Location) -> void
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.parse_method_type: (String | Buffer, ?variables: Array[Symbol], ?eof_re: Regexp?) -> MethodType
|
20
|
+
|
21
|
+
def self.parse_type: (String | Buffer, ?variables: Array[Symbol], ?eof_re: Regexp?) -> Types::t
|
22
|
+
|
23
|
+
def self.parse_signature: (String | Buffer, ?eof_re: Regexp?) -> Array[AST::Declarations::t]
|
24
|
+
end
|
25
|
+
end
|
data/sig/polyfill.rbs
CHANGED
@@ -1,3 +1,45 @@
|
|
1
1
|
module Kernel
|
2
2
|
def to_json: (*untyped) -> String
|
3
3
|
end
|
4
|
+
|
5
|
+
module Gem
|
6
|
+
class Version
|
7
|
+
def self.correct?: (String) -> bool
|
8
|
+
|
9
|
+
def self.create: (String?) -> instance?
|
10
|
+
|
11
|
+
include Comparable
|
12
|
+
|
13
|
+
def prerelease?: () -> bool
|
14
|
+
|
15
|
+
def release: () -> self
|
16
|
+
|
17
|
+
def version: () -> String
|
18
|
+
end
|
19
|
+
|
20
|
+
class Specification
|
21
|
+
attr_reader version (): Version
|
22
|
+
|
23
|
+
attr_reader gem_dir (): String
|
24
|
+
|
25
|
+
def self.find_by_name: (String name, ?String? version) -> instance
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
class OptionParser
|
30
|
+
def initialize: () ?{ (instance) -> void } -> void
|
31
|
+
|
32
|
+
def on: (*String) { (String) -> void } -> void
|
33
|
+
|
34
|
+
attr_accessor version: String
|
35
|
+
|
36
|
+
attr_accessor banner: String
|
37
|
+
|
38
|
+
def order!: (Array[String]) -> void
|
39
|
+
|
40
|
+
def parse!: (Array[String]) -> void
|
41
|
+
|
42
|
+
def ver: () -> String
|
43
|
+
|
44
|
+
def help: () -> String
|
45
|
+
end
|
data/sig/rbs.rbs
CHANGED
data/sig/repository.rbs
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
module RBS
|
2
|
+
# Set of RBS repositories.
|
3
|
+
#
|
4
|
+
# A repository object can handle multiple repository roots.
|
5
|
+
#
|
6
|
+
# repo = RBS::Repository.new()
|
7
|
+
# repo.add(Pathname("vendor/rbs/gem-rbs"))
|
8
|
+
# repo.add(Pathname("vendor/rbs/internal-rbs"))
|
9
|
+
# repo.add(Pathname("vendor/rbs/definitely-rbs"))
|
10
|
+
#
|
11
|
+
# repo.lookup("minitest", "2.1.3") => Pathname or nil
|
12
|
+
#
|
13
|
+
# If one gem version can resolve to several directories, the last added dir wins.
|
14
|
+
#
|
15
|
+
class Repository
|
16
|
+
class GemRBS
|
17
|
+
attr_reader name: String
|
18
|
+
|
19
|
+
# Array of gem dirs.
|
20
|
+
# Gem dir contains directories for each version.
|
21
|
+
attr_reader paths: Array[Pathname]
|
22
|
+
|
23
|
+
# Hash from a version to VersionPath object.
|
24
|
+
attr_reader versions(): Hash[Gem::Version, VersionPath]
|
25
|
+
|
26
|
+
@versions: Hash[Gem::Version, VersionPath]?
|
27
|
+
|
28
|
+
def initialize: (name: String) -> void
|
29
|
+
|
30
|
+
def load!: () -> void
|
31
|
+
|
32
|
+
def version_names: () -> Array[Gem::Version]
|
33
|
+
|
34
|
+
def oldest_version: () -> VersionPath
|
35
|
+
|
36
|
+
def latest_version: () -> VersionPath
|
37
|
+
|
38
|
+
def find_best_version: (Gem::Version?) -> VersionPath
|
39
|
+
|
40
|
+
# Returns true if versions is empty.
|
41
|
+
def empty?: () -> bool
|
42
|
+
end
|
43
|
+
|
44
|
+
class VersionPath
|
45
|
+
attr_reader gem: GemRBS
|
46
|
+
attr_reader version: Gem::Version
|
47
|
+
attr_reader path: Pathname
|
48
|
+
|
49
|
+
def initialize: (gem: GemRBS, version: Gem::Version, path: Pathname) -> void
|
50
|
+
end
|
51
|
+
|
52
|
+
DEFAULT_STDLIB_ROOT: Pathname
|
53
|
+
|
54
|
+
# Array of _root dir_s of repositories.
|
55
|
+
#
|
56
|
+
attr_reader dirs: Array[Pathname]
|
57
|
+
|
58
|
+
attr_reader gems: Hash[String, GemRBS]
|
59
|
+
|
60
|
+
# An optional keyword argument `no_stdlib` is to skip adding directory for stdlib classes.
|
61
|
+
# Passing truthy value will skip loading stdlib. (You can add the stdlib root by yourself.)
|
62
|
+
#
|
63
|
+
def initialize: (?no_stdlib: bool) -> void
|
64
|
+
|
65
|
+
# Add new _root dir_ to the repository set.
|
66
|
+
# If two repository dirs have exactly same gem-version definitions, the latter overwrites the prior.
|
67
|
+
#
|
68
|
+
def add: (Pathname dir) -> void
|
69
|
+
|
70
|
+
# Returns a directory for given `gem` name and `version`.
|
71
|
+
# `version` can be `nil` for _any version_.
|
72
|
+
#
|
73
|
+
# If the given gem cannot be found, it returns `nil`.
|
74
|
+
#
|
75
|
+
def lookup: (String gem, String? version) -> Pathname?
|
76
|
+
|
77
|
+
def lookup_path: (String gem, String? version) -> [GemRBS, VersionPath]?
|
78
|
+
end
|
79
|
+
end
|
data/sig/substitution.rbs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RBS
|
2
2
|
# Substitution from type variables to types.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# The substitution construction is in _destructive_ manner.
|
5
5
|
#
|
6
6
|
# sub = Substitution.new
|
@@ -25,7 +25,7 @@ module RBS
|
|
25
25
|
# Utility method to construct a substitution.
|
26
26
|
# Raises an error when `variables.size != types.size`.
|
27
27
|
# `instance_type` defaults to `nil`.
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# Yields types in `types` and the block value is used if block is given.
|
30
30
|
#
|
31
31
|
def self.build: (Array[Symbol] variables, Array[Types::t] types, ?instance_type: Types::t?) ?{ (Types::t) -> Types::t } -> instance
|
@@ -36,4 +36,4 @@ module RBS
|
|
36
36
|
# Returns a substitution without variables given in `vars`.
|
37
37
|
def without: (*Symbol vars) -> Substitution
|
38
38
|
end
|
39
|
-
end
|
39
|
+
end
|
data/sig/typename.rbs
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module RBS
|
2
2
|
# TypeName represents name of types in RBS.
|
3
|
-
#
|
3
|
+
#
|
4
4
|
# TypeNames are one of the three kind, class, alias, and interface.
|
5
5
|
# *class* type names corresponds to Ruby classes and modules.
|
6
6
|
# There are no corresponding Ruby value to *alias* and *interface* type names.
|
data/sig/types.rbs
CHANGED
data/sig/vendorer.rbs
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module RBS
|
2
|
+
# Copies RBS files loaded through `loader` under `vendor_dir`.
|
3
|
+
#
|
4
|
+
# Core libraries and library RBS files will be copied.
|
5
|
+
#
|
6
|
+
# loader = RBS::EnvironmentLoader.new()
|
7
|
+
#
|
8
|
+
# loader.add(library: set) # Libraries will be copied.
|
9
|
+
# loader.add(library: "minitest", version: "1.2.3")
|
10
|
+
#
|
11
|
+
# loader.add(path: Pathname("sig")) # Dirs will be ignored.
|
12
|
+
#
|
13
|
+
# vendorer = RBS::Vendorer.new(vendor_dir: Pathname("vendor/rbs"), loader: loader)
|
14
|
+
# vendorer.clearn!
|
15
|
+
# vendorer.copy!
|
16
|
+
#
|
17
|
+
# The result will be:
|
18
|
+
# vendor/rbs/core => Will include core RBSs
|
19
|
+
# vendor/rbs/set-0 => Will include `set` library RBSs.
|
20
|
+
# vendor/rbs/minitest-1.2.3 => Will include `minitest` library RBSs.
|
21
|
+
#
|
22
|
+
# The vendorerd RBSs will be loaded through :dir source.
|
23
|
+
#
|
24
|
+
# loader = RBS::EnvironmentLoader.new(core_root: nil, repository: RBS::Repository.new(no_stdlib: true))
|
25
|
+
# loader.add(path: Pathname("vendor/rbs"))
|
26
|
+
# loader.add(path: Pathname("sig"))
|
27
|
+
#
|
28
|
+
class Vendorer
|
29
|
+
attr_reader vendor_dir: Pathname
|
30
|
+
attr_reader loader: EnvironmentLoader
|
31
|
+
|
32
|
+
def initialize: (vendor_dir: Pathname, loader: EnvironmentLoader) -> void
|
33
|
+
|
34
|
+
# Copy RBS files into `vendor_dir`.
|
35
|
+
# Ensures the `vendor_dir` exists.
|
36
|
+
def copy!: () -> void
|
37
|
+
|
38
|
+
# Deletes `vendor_dir` and its content if exists.
|
39
|
+
#
|
40
|
+
def clean!: () -> void
|
41
|
+
|
42
|
+
def ensure_dir: [A] () { () -> A } -> A
|
43
|
+
end
|
44
|
+
end
|
data/sig/writer.rbs
CHANGED
@@ -4,37 +4,37 @@ module RBS
|
|
4
4
|
attr_reader indentation: Array[String]
|
5
5
|
|
6
6
|
def initialize: (out: IO) -> void
|
7
|
-
|
7
|
+
|
8
8
|
def indent: (?Integer size) { () -> void } -> void
|
9
|
-
|
9
|
+
|
10
10
|
def prefix: () -> String
|
11
|
-
|
11
|
+
|
12
12
|
def puts: (?String) -> void
|
13
|
-
|
13
|
+
|
14
14
|
def write_annotation: (Array[AST::Annotation]) -> void
|
15
|
-
|
15
|
+
|
16
16
|
def write_comment: (AST::Comment?) -> void
|
17
|
-
|
17
|
+
|
18
18
|
def write: (Array[AST::Declarations::t]) -> void
|
19
|
-
|
19
|
+
|
20
20
|
def write_decl: (AST::Declarations::t) -> void
|
21
|
-
|
21
|
+
|
22
22
|
def write_member: (AST::Declarations::Module::member) -> void
|
23
|
-
|
23
|
+
|
24
24
|
def name_and_params: (TypeName, AST::Declarations::ModuleTypeParams) -> String?
|
25
|
-
|
25
|
+
|
26
26
|
def name_and_args: (TypeName, Array[Types::t]) -> String?
|
27
|
-
|
27
|
+
|
28
28
|
def method_name: (Symbol) -> String
|
29
|
-
|
29
|
+
|
30
30
|
def write_def: (AST::Members::MethodDefinition) -> void
|
31
|
-
|
31
|
+
|
32
32
|
def attribute: (:reader | :writer | :accessor, AST::Members::Attribute) -> void
|
33
|
-
|
33
|
+
|
34
34
|
interface _Located
|
35
35
|
def location: () -> Location?
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def preserve_empty_line: (_Located?, _Located) -> void
|
39
39
|
end
|
40
40
|
end
|
File without changes
|
@@ -67,5 +67,5 @@ module Base64
|
|
67
67
|
# 64 Encoding with URL and Filename Safe Alphabet'' in RFC 4648. The alphabet
|
68
68
|
# uses '-' instead of '+' and '_' instead of '/'. Note that the result can still
|
69
69
|
# contain '='. You can remove the padding by setting `padding` as false.
|
70
|
-
def self?.urlsafe_encode64: (String bin, ?padding:
|
70
|
+
def self?.urlsafe_encode64: (String bin, ?padding: boolish) -> String
|
71
71
|
end
|
@@ -53,9 +53,9 @@
|
|
53
53
|
# times: 1.000000 0.000000 1.000000 ( 1.003611)
|
54
54
|
# upto: 1.030000 0.000000 1.030000 ( 1.028098)
|
55
55
|
#
|
56
|
-
# * The times for some benchmarks depend on the order in which items are run.
|
56
|
+
# * The times for some benchmarks depend on the order in which items are run.
|
57
57
|
# These differences are due to the cost of memory allocation and garbage
|
58
|
-
# collection. To avoid these discrepancies, the #bmbm method is provided.
|
58
|
+
# collection. To avoid these discrepancies, the #bmbm method is provided.
|
59
59
|
# For example, to compare ways to sort an array of floats:
|
60
60
|
#
|
61
61
|
# require 'benchmark'
|
File without changes
|
File without changes
|
@@ -49,7 +49,7 @@ module Coverage
|
|
49
49
|
# `clear` is true, it clears the counters to zero. If `stop` is true, it
|
50
50
|
# disables coverage measurement.
|
51
51
|
#
|
52
|
-
def self.result: (?stop:
|
52
|
+
def self.result: (?stop: boolish, ?clear: boolish) -> Hash[String, untyped]
|
53
53
|
|
54
54
|
# Returns true if coverage stats are currently being collected (after
|
55
55
|
# Coverage.start call, but before Coverage.result call)
|
@@ -58,5 +58,5 @@ module Coverage
|
|
58
58
|
|
59
59
|
# Enables coverage measurement.
|
60
60
|
#
|
61
|
-
def self.start: (?lines:
|
61
|
+
def self.start: (?lines: boolish, ?branches: boolish, ?methods: boolish, ?oneshot_lines: boolish) -> nil
|
62
62
|
end
|
@@ -159,7 +159,7 @@
|
|
159
159
|
# with it.
|
160
160
|
#
|
161
161
|
class CSV < Object
|
162
|
-
include Enumerable[untyped
|
162
|
+
include Enumerable[untyped]
|
163
163
|
|
164
164
|
# This method is intended as the primary interface for reading CSV files. You
|
165
165
|
# pass a `path` and any `options` you wish to set for the read. Each row of file
|
@@ -407,7 +407,7 @@ CSV::VERSION: String
|
|
407
407
|
# processing is activated.
|
408
408
|
#
|
409
409
|
class CSV::Row < Object
|
410
|
-
include Enumerable[untyped
|
410
|
+
include Enumerable[untyped]
|
411
411
|
|
412
412
|
# If a two-element Array is provided, it is assumed to be a header and field and
|
413
413
|
# the pair is appended. A Hash works the same way with the key being the header
|
@@ -578,7 +578,7 @@ end
|
|
578
578
|
# processing is activated.
|
579
579
|
#
|
580
580
|
class CSV::Table[out Elem] < Object
|
581
|
-
include Enumerable[untyped
|
581
|
+
include Enumerable[untyped]
|
582
582
|
|
583
583
|
# Constructs a new CSV::Table from `array_of_rows`, which are expected to be
|
584
584
|
# CSV::Row objects. All rows are assumed to have the same headers.
|
@@ -755,7 +755,7 @@ class CSV::Table[out Elem] < Object
|
|
755
755
|
# This method assumes you want the Table.headers(), unless you explicitly pass
|
756
756
|
# `:write_headers => false`.
|
757
757
|
#
|
758
|
-
def to_csv: (?write_headers:
|
758
|
+
def to_csv: (?write_headers: boolish, **untyped) -> untyped
|
759
759
|
|
760
760
|
alias to_s to_csv
|
761
761
|
|
@@ -178,7 +178,7 @@ class Date
|
|
178
178
|
#
|
179
179
|
# Date._parse('2001-02-03') #=> {:year=>2001, :mon=>2, :mday=>3}
|
180
180
|
#
|
181
|
-
def self._parse: (String str, ?
|
181
|
+
def self._parse: (String str, ?boolish complete) -> Hash[Symbol, Integer]
|
182
182
|
|
183
183
|
# Returns a hash of parsed elements.
|
184
184
|
#
|
@@ -318,7 +318,7 @@ class Date
|
|
318
318
|
#
|
319
319
|
def self.ordinal: (?Integer year, ?Integer yday, ?Integer start) -> Date
|
320
320
|
|
321
|
-
# Parses the given representation of date and time, and creates a date object.
|
321
|
+
# Parses the given representation of date and time, and creates a date object.
|
322
322
|
# This method does not function as a validator.
|
323
323
|
#
|
324
324
|
# If the optional second argument is true and the detected year is in the range
|
@@ -328,7 +328,7 @@ class Date
|
|
328
328
|
# Date.parse('20010203') #=> #<Date: 2001-02-03 ...>
|
329
329
|
# Date.parse('3rd Feb 2001') #=> #<Date: 2001-02-03 ...>
|
330
330
|
#
|
331
|
-
def self.parse: (String str, ?
|
331
|
+
def self.parse: (String str, ?boolish complete, ?Integer start) -> Date
|
332
332
|
|
333
333
|
# Creates a new Date object by parsing from a string according to some typical
|
334
334
|
# RFC 2822 formats.
|
@@ -448,7 +448,7 @@ class Date
|
|
448
448
|
#
|
449
449
|
def +: (Integer | Rational other) -> Date
|
450
450
|
|
451
|
-
# Returns the difference between the two dates if the other is a date object.
|
451
|
+
# Returns the difference between the two dates if the other is a date object.
|
452
452
|
# If the other is a numeric value, returns a date object pointing `other` days
|
453
453
|
# before self. If the other is a fractional number, assumes its precision is at
|
454
454
|
# most nanosecond.
|