Results for: "match"

Converts a SyntaxError message to a path

Handles the case where the filename has a colon in it such as on a windows file system: github.com/ruby/syntax_suggest/issues/111

Example:

message = "/tmp/scratch:2:in `require_relative': /private/tmp/bad.rb:1: syntax error, unexpected `end' (SyntaxError)"
puts PathnameFromMessage.new(message).call.name
# => "/tmp/scratch.rb"

RFC6068, the mailto URL scheme.

Raised when a mathematical function is evaluated outside of its domain of definition.

For example, since cos returns values in the range -1..1, its inverse function acos is only defined on that interval:

Math.acos(42)

produces:

Math::DomainError: Numerical argument is out of domain - "acos"

A Process::Status contains information about a system process.

Thread-local variable $? is initially nil. Some methods assign to it a Process::Status object that represents a system process (either running or terminated):

`ruby -e "exit 99"`
stat = $?       # => #<Process::Status: pid 1262862 exit 99>
stat.class      # => Process::Status
stat.to_i       # => 25344
stat.stopped?   # => false
stat.exited?    # => true
stat.exitstatus # => 99
No documentation available

This is not an existing class, but documentation of the interface that Scheduler object should comply to in order to be used as argument to Fiber.scheduler and handle non-blocking fibers. See also the “Non-blocking fibers” section in Fiber class docs for explanations of some concepts.

Scheduler’s behavior and usage are expected to be as follows:

This way concurrent execution will be achieved transparently for every individual Fiber’s code.

Scheduler implementations are provided by gems, like Async.

Hook methods are:

When not specified otherwise, the hook implementations are mandatory: if they are not implemented, the methods trying to call hook will fail. To provide backward compatibility, in the future hooks will be optional (if they are not implemented, due to the scheduler being created for the older Ruby version, the code which needs this hook will not fail, and will just behave in a blocking fashion).

It is also strongly recommended that the scheduler implements the fiber method, which is delegated to by Fiber.schedule.

Sample toy implementation of the scheduler can be found in Ruby’s code, in test/fiber/scheduler.rb

An ObjectSpace::WeakMap is a key-value map that holds weak references to its keys and values, so they can be garbage-collected when there are no more references left.

Keys in the map are compared by identity.

m = ObjectSpace::WeakMap.new
key1 = "foo"
val1 = Object.new
m[key1] = val1

key2 = "foo"
val2 = Object.new
m[key2] = val2

m[key1] #=> #<Object:0x0...>
m[key2] #=> #<Object:0x0...>

val1 = nil # remove the other reference to value
GC.start

m[key1] #=> nil
m.keys #=> ["bar"]

key2 = nil # remove the other reference to key
GC.start

m[key2] #=> nil
m.keys #=> []

(Note that GC.start is used here only for demonstrational purposes and might not always lead to demonstrated results.)

See also ObjectSpace::WeakKeyMap map class, which compares keys by value, and holds weak references only to the keys.

An ObjectSpace::WeakKeyMap is a key-value map that holds weak references to its keys, so they can be garbage collected when there is no more references.

Unlike ObjectSpace::WeakMap:

(Note that GC.start is used here only for demonstrational purposes and might not always lead to demonstrated results.)

The collection is especially useful for implementing caches of lightweight value objects, so that only one copy of each value representation would be stored in memory, but the copies that aren’t used would be garbage-collected.

CACHE = ObjectSpace::WeakKeyMap

def make_value(**)
   val = ValueObject.new(**)
   if (existing = @cache.getkey(val))
      # if the object with this value exists, we return it
      existing
   else
      # otherwise, put it in the cache
      @cache[val] = true
      val
   end
end

This will result in make_value returning the same object for same set of attributes always, but the values that aren’t needed anymore woudn’t be sitting in the cache forever.

No documentation available
No documentation available

This module is responsible for converting the prism syntax tree into other syntax trees.

Commands will be placed in this namespace

No documentation available
No documentation available

Mixin methods for commands that work with gemspecs.

Mixin methods for install and update options for Gem::Commands

This module is used for safely loading Marshal specs from a gem. The ‘safe_load` method defined on this module is specifically designed for loading Gem specifications.

Mixin methods for Gem::Command to promote available RubyGems update

No documentation available

The result of parsing a pack template.

No documentation available
No documentation available
No documentation available
No documentation available

Searches for gems starting with the supplied argument.

Search took: 7ms  ·  Total Results: 1903