Class: Tuple

Inherits:
Array show all
Includes:
Comparable
Defined in:
lib/carat/tuple.rb

Overview

Tuple

A Tuple is essentially an Array that is also Comaparable.

Usage

t1 = Tuple.new(1,2,3)
t2 = Tuple.new(2,3,4)

t1 > t2   #=> false
t2 > t1   #=> true

Note

This class probably needs some enhancements to be truly considered a Tuple. For instance, should a Tuple by multiton?

Instance Method Summary collapse

Methods inherited from Array

#[], #apply_snapshot, #at, #take_snapshot, #values_at

Constructor Details

#initialize(*args) ⇒ Tuple

Returns a new instance of Tuple.



26
27
28
29
# File 'lib/carat/tuple.rb', line 26

def initialize(*args)
  super()
  self.concat args
end