Class: Bake::Types::Tuple

Inherits:
Object
  • Object
show all
Includes:
Type
Defined in:
lib/bake/types/tuple.rb

Instance Method Summary collapse

Methods included from Type

#|

Constructor Details

#initialize(item_types) ⇒ Tuple

Returns a new instance of Tuple.



28
29
30
# File 'lib/bake/types/tuple.rb', line 28

def initialize(item_types)
	@item_types = item_types
end

Instance Method Details

#composite?Boolean

Returns:



32
33
34
# File 'lib/bake/types/tuple.rb', line 32

def composite?
	true
end

#parse(input) ⇒ Object



36
37
38
# File 'lib/bake/types/tuple.rb', line 36

def parse(input)
	input.split(',').map{|value| @item_type.parse(value)}
end

#to_sObject



40
41
42
# File 'lib/bake/types/tuple.rb', line 40

def to_s
	"a Tuple of (#{@item_types.join(', ')})"
end