Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
17 lines (12 sloc) 307 Bytes
Tomato = {}
Tomato.Color = {red, green, blue, yellow}
Tomato.new = function(color)
return {color: color? Tomato.Color.red}
end
Tomato.throw = function(tmto)
puts "Threw a " + tmto.color + " tomato"
end
tmto = Tomato.new()
tmto2 = Tomato.new(Tomato.Color.blue)
Tomato.throw(tmto)
Tomato.throw(tmto2)