Results for: "Pathname"

Represents a block parameter to a method, block, or lambda definition.

def a(&b)
      ^^
end

Represents a block’s parameters declaration.

-> (a, b = 1; local) { }
   ^^^^^^^^^^^^^^^^^

foo do |a, b = 1; local|
       ^^^^^^^^^^^^^^^^^
end

Represents the use of the ‘&&=` operator for assignment to a constant path.

Parent::Child &&= value
^^^^^^^^^^^^^^^^^^^^^^^

Represents the use of the ‘||=` operator for assignment to a constant path.

Parent::Child ||= value
^^^^^^^^^^^^^^^^^^^^^^^

Represents writing to a constant path in a context that doesn’t have an explicit value.

Foo::Foo, Bar::Bar = baz
^^^^^^^^  ^^^^^^^^

Represents writing to a constant path.

::Foo = 1
^^^^^^^^^

Foo::Bar = 1
^^^^^^^^^^^^

::Foo::Bar = 1
^^^^^^^^^^^^^^

Represents the use of the forwarding parameter in a method, block, or lambda declaration.

def foo(...)
        ^^^
end

Represents a keyword rest parameter to a method, block, or lambda definition.

def a(**b)
      ^^^
end

Represents the use of ‘**nil` inside method arguments.

def a(**nil)
      ^^^^^
end

Represents an implicit set of parameters through the use of numbered parameters within a block or lambda.

-> { _1 + _2 }
^^^^^^^^^^^^^^

Represents the list of parameters on a method, block, or lambda definition.

def a(b, c, d)
      ^^^^^^^
end

Represents a required keyword parameter to a method, block, or lambda definition.

def a(b: )
      ^^
end

Represents a required parameter to a method, block, or lambda definition.

def a(b)
      ^
end

Represents a rest parameter to a method, block, or lambda definition.

def a(*b)
      ^^
end
No documentation available

Raised by Gem::WebauthnListener when an error occurs during security device verification.

Represents a gem of name name at version of platform. These wrap the data returned from the indexes.

Gem::PathSupport facilitates the GEM_HOME and GEM_PATH environment settings to the rest of RubyGems.

No documentation available
No documentation available

Numeric is the class from which all higher-level numeric classes should inherit.

Numeric allows instantiation of heap-allocated objects. Other core numeric classes such as Integer are implemented as immediates, which means that each Integer is a single immutable object which is always passed by value.

a = 1
1.object_id == a.object_id   #=> true

There can only ever be one instance of the integer 1, for example. Ruby ensures this by preventing instantiation. If duplication is attempted, the same instance is returned.

Integer.new(1)                   #=> NoMethodError: undefined method `new' for Integer:Class
1.dup                            #=> 1
1.object_id == 1.dup.object_id   #=> true

For this reason, Numeric should be used when defining other numeric classes.

Classes which inherit from Numeric must implement coerce, which returns a two-member Array containing an object that has been coerced into an instance of the new class and self (see coerce).

Inheriting classes should also implement arithmetic operator methods (+, -, * and /) and the <=> operator (see Comparable). These methods may rely on coerce to ensure interoperability with instances of other numeric classes.

class Tally < Numeric
  def initialize(string)
    @string = string
  end

  def to_s
    @string
  end

  def to_i
    @string.size
  end

  def coerce(other)
    [self.class.new('|' * other.to_i), self]
  end

  def <=>(other)
    to_i <=> other.to_i
  end

  def +(other)
    self.class.new('|' * (to_i + other.to_i))
  end

  def -(other)
    self.class.new('|' * (to_i - other.to_i))
  end

  def *(other)
    self.class.new('|' * (to_i * other.to_i))
  end

  def /(other)
    self.class.new('|' * (to_i / other.to_i))
  end
end

tally = Tally.new('||')
puts tally * 2            #=> "||||"
puts tally > 1            #=> true

What’s Here

First, what’s elsewhere. Class Numeric:

Here, class Numeric provides methods for:

Querying

Comparing

Converting

Other

A Float object represents a sometimes-inexact real number using the native architecture’s double-precision floating point representation.

Floating point has a different arithmetic and is an inexact number. So you should know its esoteric system. See following:

You can create a Float object explicitly with:

You can convert certain objects to Floats with:

What’s Here

First, what’s elsewhere. Class Float:

Here, class Float provides methods for:

Querying

Comparing

Converting

Continuation objects are generated by Kernel#callcc, after having +require+d continuation. They hold a return address and execution context, allowing a nonlocal return to the end of the callcc block from anywhere within a program. Continuations are somewhat analogous to a structured version of C’s setjmp/longjmp (although they contain more state, so you might consider them closer to threads).

For instance:

require "continuation"
arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ]
callcc{|cc| $cc = cc}
puts(message = arr.shift)
$cc.call unless message =~ /Max/

produces:

Freddie
Herbie
Ron
Max

Also you can call callcc in other methods:

require "continuation"

def g
  arr = [ "Freddie", "Herbie", "Ron", "Max", "Ringo" ]
  cc = callcc { |cc| cc }
  puts arr.shift
  return cc, arr.size
end

def f
  c, size = g
  c.call(c) if size > 1
end

f

This (somewhat contrived) example allows the inner loop to abandon processing early:

require "continuation"
callcc {|cont|
  for i in 0..4
    print "#{i}: "
    for j in i*5...(i+1)*5
      cont.call() if j == 17
      printf "%3d", j
    end
  end
}
puts

produces:

0:   0  1  2  3  4
1:   5  6  7  8  9
2:  10 11 12 13 14
3:  15 16

Raised to stop the iteration, in particular by Enumerator#next. It is rescued by Kernel#loop.

loop do
  puts "Hello"
  raise StopIteration
  puts "World"
end
puts "Done!"

produces:

Hello
Done!

Raised by exit to initiate the termination of the script.

Search took: 3ms  ·  Total Results: 2920