Results for: "Array"

Compile a ArrayPatternNode node

Dispatch enter and leave events for ArrayPatternNode nodes and continue walking the tree.

Copy a ArrayPatternNode node

in [foo, bar, baz]

No documentation available

Represents an array literal. This can be a regular array using brackets or a special array using % like %w or %i.

[1, 2, 3]
^^^^^^^^^

Represents an array pattern in pattern matching.

foo in 1, 2
^^^^^^^^^^^

foo in [1, 2]
^^^^^^^^^^^^^

foo in *1
^^^^^^^^^

foo in Bar[]
^^^^^^^^^^^^

foo in Bar[1, 2, 3]
^^^^^^^^^^^^^^^^^^^

Flags for array nodes.

This string is put at the end of a line that holds a JSON array.

This string is put at the end of a line that holds a JSON array.

No documentation available

The most standard error types are subclasses of StandardError. A rescue clause without an explicit Exception class will rescue all StandardErrors (and only those).

def foo
  raise "Oups"
end
foo rescue "Hello"   #=> "Hello"

On the other hand:

require 'does/not/exist' rescue "Hi"

raises the exception:

LoadError: no such file to load -- does/not/exist

Raised when the arguments are wrong and there isn’t a more specific Exception class.

Ex: passing the wrong number of arguments

[1, 2, 3].first(4, 5)

raises the exception:

ArgumentError: wrong number of arguments (given 2, expected 1)

Ex: passing an argument that is not acceptable:

[1, 2, 3].first(-4)

raises the exception:

ArgumentError: negative array size

Raised when a given numerical value is out of range.

[1, 2, 3].drop(1 << 100)

raises the exception:

RangeError: bignum too big to convert into `long'

The Comparable mixin is used by classes whose objects may be ordered. The class must define the <=> operator, which compares the receiver against another object, returning a value less than 0, returning 0, or returning a value greater than 0, depending on whether the receiver is less than, equal to, or greater than the other object. If the other object is not comparable then the <=> operator should return nil. Comparable uses <=> to implement the conventional comparison operators (<, <=, ==, >=, and >) and the method between?.

class StringSorter
  include Comparable

  attr :str
  def <=>(other)
    str.size <=> other.str.size
  end

  def initialize(str)
    @str = str
  end

  def inspect
    @str
  end
end

s1 = StringSorter.new("Z")
s2 = StringSorter.new("YY")
s3 = StringSorter.new("XXX")
s4 = StringSorter.new("WWWW")
s5 = StringSorter.new("VVVVV")

s1 < s2                       #=> true
s4.between?(s1, s3)           #=> false
s4.between?(s3, s5)           #=> true
[ s3, s2, s5, s4, s1 ].sort   #=> [Z, YY, XXX, WWWW, VVVVV]

What’s Here

Module Comparable provides these methods, all of which use method <=>:

Wrapper for arrays within a struct

An Array wrapper that can be sent to another server via DRb.

All entries in the array will be dumped or be references that point to the local server.

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

def foo(...)
        ^^^
end

Cleared reference exception

This exception is raised if a parser error occurs.

This exception is raised if a generator or unparser error occurs.

No documentation available

Response class for Found responses (status code 302).

The Found response indicates that the client should look at (browse to) another URL.

References:

Response class for Temporary Redirect responses (status code 307).

The request should be repeated with another URI; however, future requests should still use the original URI.

References:

Response class for Payload Too Large responses (status code 413).

The request is larger than the server is willing or able to process.

References:

Search took: 2ms  ·  Total Results: 1972