Class: Bake::Types::Tuple

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

Instance Method Summary collapse

Constructor Details

#initialize(item_types) ⇒ Tuple

Returns a new instance of Tuple.



24
25
26
# File 'lib/bake/types/tuple.rb', line 24

def initialize(item_types)
	@item_types = item_types
end

Instance Method Details

#composite?Boolean

Returns:

  • (Boolean)


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

def composite?
	true
end

#parse(input) ⇒ Object



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

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

#to_sObject



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

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