Results for: "module_function"

Foo = 1 ^^^^^^^

Foo, Bar = 1 ^^^ ^^^

Foo, = bar ^^^

Foo::Bar ^^^^^^^^

Foo ^^^

Foo = 1 ^^^^^^^

Foo, Bar = 1 ^^^ ^^^

Foo, = bar ^^^

Foo::Bar ^^^^^^^^

If the bounds of a range node are empty parentheses, then they do not get replaced by their usual s(:nil), but instead are s(:begin).

$+ ^^

Foo += bar ^^^^^^^^^^^

Foo &&= bar ^^^^^^^^^^^^

Foo ||= bar ^^^^^^^^^^^^

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

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

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

$1 ^^

Returns self modulo other as a real number.

For integer n and real number r, these expressions are equivalent:

n % r
n-r*(n/r).floor
n.divmod(r)[1]

See Numeric#divmod.

Examples:

10 % 2              # => 0
10 % 3              # => 1
10 % 4              # => 2

10 % -2             # => 0
10 % -3             # => -2
10 % -4             # => -2

10 % 3.0            # => 1.0
10 % Rational(3, 1) # => (1/1)

Returns self modulo other as a real number.

Of the Core and Standard Library classes, only Rational uses this implementation.

For Rational r and real number n, these expressions are equivalent:

r % n
r-n*(r/n).floor
r.divmod(n)[1]

See Numeric#divmod.

Examples:

r = Rational(1, 2)    # => (1/2)
r2 = Rational(2, 3)   # => (2/3)
r % r2                # => (1/2)
r % 2                 # => (1/2)
r % 2.0               # => 0.5

r = Rational(301,100) # => (301/100)
r2 = Rational(7,5)    # => (7/5)
r % r2                # => (21/100)
r % -r2               # => (-119/100)
(-r) % r2             # => (119/100)
(-r) %-r2             # => (-21/100)

Returns self modulo other as a float.

For float f and real number r, these expressions are equivalent:

f % r
f-r*(f/r).floor
f.divmod(r)[1]

See Numeric#divmod.

Examples:

10.0 % 2              # => 0.0
10.0 % 3              # => 1.0
10.0 % 4              # => 2.0

10.0 % -2             # => 0.0
10.0 % -3             # => -2.0
10.0 % -4             # => -2.0

10.0 % 4.0            # => 2.0
10.0 % Rational(4, 1) # => 2.0

Returns garbage collector generation for the given object.

class B
  include ObjectSpace

  def foo
    trace_object_allocations do
      obj = Object.new
      p "Generation is #{allocation_generation(obj)}"
    end
  end
end

B.new.foo #=> "Generation is 3"

See ::trace_object_allocations for more information and examples.

$+ ^^

Foo += bar ^^^^^^^^^^^

Foo &&= bar ^^^^^^^^^^^^

Foo ||= bar ^^^^^^^^^^^^

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

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

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

Search took: 4ms  ·  Total Results: 3346