diff --git a/core/binding.rbs b/core/binding.rbs index fea7af371..31952d547 100644 --- a/core/binding.rbs +++ b/core/binding.rbs @@ -48,6 +48,72 @@ class Binding # def eval: (string src, ?string filename, ?int lineno) -> untyped + # + # Returns `true` if the numbered parameter or "it" parameter exists. + # + # def foo + # [42].each do + # it + # binding.implicit_parameter_defined?(:it) #=> true + # binding.implicit_parameter_defined?(:_1) #=> false + # end + # + # { k: 42 }.each do + # _2 + # binding.implicit_parameter_defined?(:_1) #=> true + # binding.implicit_parameter_defined?(:_2) #=> true + # binding.implicit_parameter_defined?(:_3) #=> false + # binding.implicit_parameter_defined?(:it) #=> false + # end + # end + # + def implicit_parameter_defined?: (interned symbol) -> bool + + # + # Returns the value of the numbered parameter or "it" parameter. + # + # def foo + # [42].each do + # it + # binding.implicit_parameter_get(:it) #=> 42 + # end + # + # { k: 42 }.each do + # _2 + # binding.implicit_parameter_get(:_1) #=> :k + # binding.implicit_parameter_get(:_2) #=> 42 + # end + # end + # + def implicit_parameter_get: (interned symbol) -> untyped + + # + # Returns the names of numbered parameters and "it" parameter that are defined + # in the binding. + # + # def foo + # [42].each do + # it + # binding.implicit_parameters #=> [:it] + # end + # + # { k: 42 }.each do + # _2 + # binding.implicit_parameters #=> [:_1, :_2] + # end + # end + # + def implicit_parameters: () -> Array[Symbol] + # + # Returns the Encoding object that represents the encoding of the stream, or + # `nil` if the stream is in write mode and no encoding is specified. + # + # See [Encodings](rdoc-ref:File@Encodings). + # + def external_encoding: () -> Encoding? + # + # Returns the path associated with the IO, or `nil` if there is no path + # associated with the IO. It is not guaranteed that the path exists on the + # filesystem. + # + # $stdin.path # => "" + # + # File.open("testfile") {|f| f.path} # => "testfile" + # + alias to_path path + # # Returns `true` if the stream is associated with a terminal device (tty), # `false` otherwise: diff --git a/core/io/wait.rbs b/core/io/wait.rbs index e5a5e797d..0f7efe189 100644 --- a/core/io/wait.rbs +++ b/core/io/wait.rbs @@ -25,6 +25,17 @@ class IO type wait_mode = :read | :r | :readable | :write | :w | :writable | :read_write | :rw | :readable_writable + # + # Waits until IO is priority and returns a truthy value or a falsy value when + # times out. Priority data is sent and received using the Socket::MSG_OOB flag + # and is typically limited to streams. + # + def wait_priority: (?Time::_Timeout? timeout) -> boolish + # + # user time used in this process + # + attr_accessor utime: Float + + # + # system time used in this process + # + attr_accessor stime: Float + + # + # user time used in the child processes + # + attr_accessor cutime: Float + + # + # system time used in the child processes + # + attr_accessor cstime: Float end class Process::Waiter < Thread diff --git a/core/thread.rbs b/core/thread.rbs index 4ce6bc7a6..234a380cd 100644 --- a/core/thread.rbs +++ b/core/thread.rbs @@ -647,6 +647,19 @@ class Thread < Object # check $SAFE. def safe_level: () -> Integer + # + # Establishes *proc* on *thr* as the handler for tracing, or disables tracing if + # the parameter is `nil`. + # + # See Kernel#set_trace_func. + # + def set_trace_func: (Proc proc) -> Proc + | (nil) -> nil + #