Results for: "partition"

Replaces the elements of self with the elements of other_array, which must be an array-convertible object; returns self:

a = ['a', 'b', 'c']   # => ["a", "b", "c"]
a.replace(['d', 'e']) # => ["d", "e"]

Related: see Methods for Assigning.

Replaces the contents of self with the contents of other_string:

s = 'foo'        # => "foo"
s.replace('bar') # => "bar"

Returns whether self starts with any of the given string_or_regexp.

Matches patterns against the beginning of self. For each given string_or_regexp, the pattern is:

Returns true if any pattern matches the beginning, false otherwise:

'hello'.start_with?('hell')               # => true
'hello'.start_with?(/H/i)                 # => true
'hello'.start_with?('heaven', 'hell')     # => true
'hello'.start_with?('heaven', 'paradise') # => false
'тест'.start_with?('т')                   # => true
'こんにちは'.start_with?('こ')              # => true

Related: String#end_with?.

Returns whether ASCII-compatible or not.

Encoding::UTF_8.ascii_compatible?     #=> true
Encoding::UTF_16BE.ascii_compatible?  #=> false

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.

You must require ‘io/wait’ to use this method.

Returns true if matching against re can be done in linear time to the input string.

Regexp.linear_time?(/re/) # => true

Note that this is a property of the ruby interpreter, not of the argument regular expression. Identical regexp can or cannot run in linear time depending on your ruby binary. Neither forward nor backward compatibility is guaranteed about the return value of this method. Our current algorithm is (*1) but this is subject to change in the future. Alternative implementations can also behave differently. They might always return false for everything.

(*1): doi.org/10.1109/SP40001.2021.00032

No documentation available

Equivalent to self.to_s.start_with?; see String#start_with?.

Returns a shallow copy of self; the [stored string] in the copy is the same string as in self.

Replaces the entire contents of self with the contents of other_hash; returns self:

h = {foo: 0, bar: 1, baz: 2}
h.replace({bat: 3, bam: 4}) # => {bat: 3, bam: 4}

Related: see Methods for Assigning.

The version of the Marshal format for your Ruby.

How String Gem paths should be split. Overridable for esoteric platforms.

Get a single optional argument from the command line. If more than one argument is given, return only the first. Return nil if none are given.

No documentation available
No documentation available

Invoked by Ruby’s core methods to run a blocking operation in a non-blocking way.

Minimal suggested implementation is:

def blocking_operation_wait(work)
  Thread.new(&work).join
end

Returns whether the HTTP session is to be kept alive.

No documentation available

Marshal dumps exit locations to the given filename.

Usage:

If --yjit-exit-locations is passed, a file named “yjit_exit_locations.dump” will automatically be generated.

If you want to collect traces manually, call dump_exit_locations directly.

Note that calling this in a script will generate stats after the dump is created, so the stats data may include exits from the dump itself.

In a script call:

at_exit do
  RubyVM::YJIT.dump_exit_locations("my_file.dump")
end

Then run the file with the following options:

ruby --yjit --yjit-trace-exits test.rb

Once the code is done running, use Stackprof to read the dump file. See Stackprof documentation for options.

Stop tracing object allocations.

Note that if ::trace_object_allocations_start is called n-times, then tracing will stop after calling ::trace_object_allocations_stop n-times.

Return the value that should be dumped for the command_line option.

Called before each event with line/column information.

No documentation available

Parse and return a Time from string

No documentation available
Search took: 2ms  ·  Total Results: 2830