Sha256: f44c8630cd6996de022792870d68db94c598c2145136ec2c3532176791f30ccb

Contents?: true

Size: 768 Bytes

Versions: 3

Compression:

Stored size: 768 Bytes

Contents

Tuple = Rubinius Tuple
class Tuple {
  ruby_alias: 'size
  ruby_alias: 'to_a

  def initialize: size {
    """
    @size Size of the @Tuple@ (amount of values to hold).

    Initializes a new @Tuple@ with a given amount of element slots.
    E.g. if @size is @2, creates a 2-Tuple.
    """

    initialize(size)
  }

  def at: idx {
    """
    @idx Index for the element to get.
    @return Element at the given index within the @Tuple@ or @nil.

    Returns an element at a given indes.
    Possibly throws an @Rubinius::ObjectBoundsExceededError@.
    """

    at(idx)
  }

  def at: idx put: val {
    """
    @idx Index of element to set.
    @val Value to set at given index.

    Sets a value for a given index within a @Tuple@.
    """
    put(idx, val)
  }
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fancy-0.3.3 lib/rbx/tuple.fy
fancy-0.3.2 lib/rbx/tuple.fy
fancy-0.3.1 lib/rbx/tuple.fy