Class | Prelude::Tuple |
In: |
lib/prelude/tuple.rb
|
Parent: | Array |
$Id: tuple.rb 7 2006-09-06 17:03:26Z prelude $
The Tuple’s being an Array should be considered an implementation inheritance.
# File lib/prelude/tuple.rb, line 31 31: def initialize(*args) 32: case 33: when args.nil? || args.empty? : 34: self[0] = self[1] = nil 35: when args.length == 1 && args[0].kind_of?(Array) : 36: self[0] = args[0][0] 37: self[1] = args[0][1..-1] 38: when args.length == 1 : 39: self[0] = args[0] 40: self[1] = nil 41: when args.length == 2 : 42: self[0] = args[0] 43: self[1] = args[1] 44: when args.length > 2 : 45: self[0] = args[0] 46: self[1] = args[1..-1] 47: end # case 48: end