rbs 1.7.0.beta.2 → 1.7.0.beta.3
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 +20 -1
- data/.gitignore +9 -1
- data/CHANGELOG.md +9 -1
- data/Rakefile +15 -0
- data/ext/rbs_extension/constants.c +0 -1
- data/ext/rbs_extension/lexer.c +2526 -1063
- data/ext/rbs_extension/lexer.h +33 -17
- data/ext/rbs_extension/lexer.re +140 -0
- data/ext/rbs_extension/lexstate.c +139 -0
- data/ext/rbs_extension/parser.c +0 -32
- data/ext/rbs_extension/parser.h +0 -5
- data/ext/rbs_extension/ruby_objs.c +84 -148
- data/lib/rbs/collection/installer.rb +1 -0
- data/lib/rbs/errors.rb +6 -0
- data/lib/rbs/parser_aux.rb +37 -5
- data/lib/rbs/parser_compat/lexer_error.rb +4 -0
- data/lib/rbs/parser_compat/located_value.rb +5 -0
- data/lib/rbs/parser_compat/semantics_error.rb +4 -0
- data/lib/rbs/parser_compat/syntax_error.rb +4 -0
- data/lib/rbs/types.rb +2 -2
- data/lib/rbs/version.rb +1 -1
- data/lib/rbs.rb +11 -0
- data/sig/parser.rbs +2 -0
- data/sig/rbs.rbs +4 -0
- data/stdlib/io-console/0/io-console.rbs +137 -0
- data/stdlib/net-http/0/net-http.rbs +2 -1
- data/stdlib/tempfile/0/tempfile.rbs +4 -6
- metadata +9 -2
data/sig/parser.rbs
CHANGED
data/sig/rbs.rbs
CHANGED
@@ -0,0 +1,137 @@
|
|
1
|
+
class IO
|
2
|
+
class ConsoleMode
|
3
|
+
def echo=: (bool) -> bool
|
4
|
+
def raw: (?min: int, ?time: int, ?intr: bool) -> self
|
5
|
+
def raw!: (?min: int, ?time: int, ?intr: bool) -> self
|
6
|
+
end
|
7
|
+
|
8
|
+
# Returns an File instance opened console.
|
9
|
+
#
|
10
|
+
# If `sym` is given, it will be sent to the opened console with `args` and the
|
11
|
+
# result will be returned instead of the console IO itself.
|
12
|
+
def self.console: () -> File?
|
13
|
+
| (:close) -> nil
|
14
|
+
| (Symbol sym, *untyped args) -> untyped
|
15
|
+
|
16
|
+
# returns console window size
|
17
|
+
#
|
18
|
+
# You must require 'io/console/size' to use this method.
|
19
|
+
def self.console_size: () -> [Integer, Integer]
|
20
|
+
|
21
|
+
# fallback to console window size
|
22
|
+
#
|
23
|
+
# You must require 'io/console/size' to use this method.
|
24
|
+
def self.default_console_size: -> [Integer, Integer]
|
25
|
+
|
26
|
+
def beep: () -> self
|
27
|
+
|
28
|
+
def check_winsize_changed: () { () -> void } -> self
|
29
|
+
def clear_screen: () -> self
|
30
|
+
|
31
|
+
# Returns a data represents the current console mode.
|
32
|
+
def console_mode: () -> IO::ConsoleMode
|
33
|
+
|
34
|
+
# Sets the console mode to `mode`.
|
35
|
+
def console_mode=: (IO::ConsoleMode mode) -> IO::ConsoleMode
|
36
|
+
|
37
|
+
# Yields `self` within cooked mode.
|
38
|
+
#
|
39
|
+
# STDIN.cooked(&:gets)
|
40
|
+
#
|
41
|
+
# will read and return a line with echo back and line editing.
|
42
|
+
def cooked: [T] () { (self) -> T } -> T
|
43
|
+
|
44
|
+
# Enables cooked mode.
|
45
|
+
#
|
46
|
+
# If the terminal mode needs to be back, use io.cooked { ... }.
|
47
|
+
def cooked!: () -> self
|
48
|
+
|
49
|
+
def cursor: () -> [Integer, Integer]
|
50
|
+
def cursor=: ([Integer, Integer]) -> [Integer, Integer]
|
51
|
+
|
52
|
+
def cursor_down: (int) -> self
|
53
|
+
def cursor_left: (int) -> self
|
54
|
+
def cursor_right: (int) -> self
|
55
|
+
def cursor_up: (int) -> self
|
56
|
+
|
57
|
+
# Enables/disables echo back. On some platforms, all combinations of this flags
|
58
|
+
# and raw/cooked mode may not be valid.
|
59
|
+
def echo=: (bool flag) -> bool
|
60
|
+
|
61
|
+
# Returns `true` if echo back is enabled.
|
62
|
+
def echo?: () -> bool
|
63
|
+
|
64
|
+
def erase_line: (0 | 1 | 2 | nil) -> self
|
65
|
+
def erase_screen: (0 | 1 | 2 | 3 | nil) -> self
|
66
|
+
|
67
|
+
# Reads and returns a character in raw mode.
|
68
|
+
#
|
69
|
+
# See IO#raw for details on the parameters.
|
70
|
+
def getch: (?min: int, ?time: int, ?intr: bool) -> String
|
71
|
+
|
72
|
+
# Reads and returns a line without echo back.
|
73
|
+
# Prints +prompt+ unless it is +nil+.
|
74
|
+
#
|
75
|
+
# The newline character that terminates the
|
76
|
+
# read line is removed from the returned string,
|
77
|
+
# see String#chomp!.
|
78
|
+
def getpass: (?String) -> String
|
79
|
+
|
80
|
+
def goto: (int, int) -> self
|
81
|
+
|
82
|
+
def goto_column: (int) -> self
|
83
|
+
|
84
|
+
# Flushes input buffer in kernel.
|
85
|
+
def iflush: () -> self
|
86
|
+
|
87
|
+
# Flushes input and output buffers in kernel.
|
88
|
+
def ioflush: () -> self
|
89
|
+
|
90
|
+
# Yields `self` with disabling echo back.
|
91
|
+
#
|
92
|
+
# STDIN.noecho(&:gets)
|
93
|
+
#
|
94
|
+
# will read and return a line without echo back.
|
95
|
+
def noecho: [T] () { (self) -> T } -> T
|
96
|
+
|
97
|
+
# Flushes output buffer in kernel.
|
98
|
+
def oflush: () -> self
|
99
|
+
|
100
|
+
def pressed?: (Integer | Symbol | String) -> bool
|
101
|
+
|
102
|
+
# Yields `self` within raw mode, and returns the result of the block.
|
103
|
+
#
|
104
|
+
# STDIN.raw(&:gets)
|
105
|
+
#
|
106
|
+
# will read and return a line without echo back and line editing.
|
107
|
+
#
|
108
|
+
# The parameter `min` specifies the minimum number of bytes that should be
|
109
|
+
# received when a read operation is performed. (default: 1)
|
110
|
+
#
|
111
|
+
# The parameter `time` specifies the timeout in *seconds* with a precision of
|
112
|
+
# 1/10 of a second. (default: 0)
|
113
|
+
#
|
114
|
+
# If the parameter `intr` is `true`, enables break, interrupt, quit, and suspend
|
115
|
+
# special characters.
|
116
|
+
#
|
117
|
+
# Refer to the manual page of termios for further details.
|
118
|
+
def raw: [T] (?min: int, ?time: int, ?intr: bool) { (self) -> T } -> T
|
119
|
+
|
120
|
+
# Enables raw mode, and returns `io`.
|
121
|
+
#
|
122
|
+
# If the terminal mode needs to be back, use `io.raw { ... }`.
|
123
|
+
#
|
124
|
+
# See IO#raw for details on the parameters.
|
125
|
+
def raw!: (?min: int, ?time: int, ?intr: bool) -> self
|
126
|
+
|
127
|
+
def scroll_backward: (int) -> self
|
128
|
+
def scroll_forward: (int) -> self
|
129
|
+
|
130
|
+
# Returns console size.
|
131
|
+
def winsize: () -> [Integer, Integer]
|
132
|
+
|
133
|
+
# Tries to set console size. The effect depends on the platform and the running
|
134
|
+
# environment.
|
135
|
+
def winsize=: ([Integer, Integer]) -> [Integer, Integer]
|
136
|
+
| ([Integer, Integer, Integer, Integer]) -> [Integer, Integer, Integer, Integer]
|
137
|
+
end
|
@@ -1204,6 +1204,7 @@ module Net
|
|
1204
1204
|
|
1205
1205
|
class HTTPRequest < HTTPGenericRequest
|
1206
1206
|
def initialize: (String path, ?Hash[String, untyped] initheader) -> void
|
1207
|
+
| (URI::Generic uri, ?Hash[String, untyped] initheader) -> void
|
1207
1208
|
end
|
1208
1209
|
|
1209
1210
|
class HTTP::Get < HTTPRequest
|
@@ -1843,4 +1844,4 @@ module Net
|
|
1843
1844
|
class HTTPFatalError < ProtoFatalError
|
1844
1845
|
include Net::HTTPExceptions
|
1845
1846
|
end
|
1846
|
-
end
|
1847
|
+
end
|
@@ -95,8 +95,8 @@ class Tempfile < File
|
|
95
95
|
# # ... do something with f ...
|
96
96
|
# end
|
97
97
|
#
|
98
|
-
def self.create: (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) -> File
|
99
|
-
| [A] (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) { (File) -> A } -> A
|
98
|
+
def self.create: (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) -> File
|
99
|
+
| [A] (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) { (File) -> A } -> A
|
100
100
|
|
101
101
|
# Creates a new Tempfile.
|
102
102
|
#
|
@@ -220,8 +220,6 @@ class Tempfile < File
|
|
220
220
|
def initialize: (::Tempfile tmpfile) -> void
|
221
221
|
end
|
222
222
|
|
223
|
-
private
|
224
|
-
|
225
223
|
# Creates a temporary file with permissions 0600 (= only readable and writable
|
226
224
|
# by the owner) and opens it with mode "w+".
|
227
225
|
#
|
@@ -265,6 +263,6 @@ class Tempfile < File
|
|
265
263
|
# If Tempfile.new cannot find a unique filename within a limited number of
|
266
264
|
# tries, then it will raise an exception.
|
267
265
|
#
|
268
|
-
def self.new: (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) -> instance
|
269
|
-
| [A] (?String basename, ?String? tmpdir, ?mode: Integer, **untyped) { (instance) -> A } -> A
|
266
|
+
def self.new: (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) -> instance
|
267
|
+
| [A] (?(String | [String, String]) basename, ?String? tmpdir, ?mode: Integer, **untyped) { (instance) -> A } -> A
|
270
268
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rbs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.0.beta.
|
4
|
+
version: 1.7.0.beta.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Soutaro Matsumoto
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: RBS is the language for type signatures for Ruby and standard library
|
14
14
|
definitions.
|
@@ -103,6 +103,8 @@ files:
|
|
103
103
|
- ext/rbs_extension/extconf.rb
|
104
104
|
- ext/rbs_extension/lexer.c
|
105
105
|
- ext/rbs_extension/lexer.h
|
106
|
+
- ext/rbs_extension/lexer.re
|
107
|
+
- ext/rbs_extension/lexstate.c
|
106
108
|
- ext/rbs_extension/location.c
|
107
109
|
- ext/rbs_extension/location.h
|
108
110
|
- ext/rbs_extension/main.c
|
@@ -152,6 +154,10 @@ files:
|
|
152
154
|
- lib/rbs/namespace.rb
|
153
155
|
- lib/rbs/parser.y
|
154
156
|
- lib/rbs/parser_aux.rb
|
157
|
+
- lib/rbs/parser_compat/lexer_error.rb
|
158
|
+
- lib/rbs/parser_compat/located_value.rb
|
159
|
+
- lib/rbs/parser_compat/semantics_error.rb
|
160
|
+
- lib/rbs/parser_compat/syntax_error.rb
|
155
161
|
- lib/rbs/prototype/rb.rb
|
156
162
|
- lib/rbs/prototype/rbi.rb
|
157
163
|
- lib/rbs/prototype/runtime.rb
|
@@ -245,6 +251,7 @@ files:
|
|
245
251
|
- stdlib/fileutils/0/fileutils.rbs
|
246
252
|
- stdlib/find/0/find.rbs
|
247
253
|
- stdlib/forwardable/0/forwardable.rbs
|
254
|
+
- stdlib/io-console/0/io-console.rbs
|
248
255
|
- stdlib/ipaddr/0/ipaddr.rbs
|
249
256
|
- stdlib/json/0/json.rbs
|
250
257
|
- stdlib/logger/0/formatter.rbs
|