From: "Vinícius Baggio Fuentes" Date: 2010-04-25T09:01:08+09:00 Subject: Re: Defining your own typecaster --0016e6550dc255f3e20485045b2d Content-Type: text/plain; charset=ISO-8859-1 I've seen the following declaration, which I think it is valid: module Kernel def Foo(*objs) Foo.new(objs) end end I'm not sure if there's another way one could achieve that, but works for the purpose. Vinicius Baggio Fuentes http://www.vinibaggio.com On Sat, Apr 24, 2010 at 8:37 PM, Josh Cheek wrote: > Hi, how do you define your own typecaster? > > Builtin examples > > Array(1..5) # => [1, 2, 3, 4, 5] > Integer(5.2) # => 5 > Float(5) # => 5.0 > > > I would expect it to be something like this > > class Foo > def self.()(*objs) > Foo.new > end > end > > Foo(1) > > > But that isn't valid syntax, and I'm not sure what to look up to figure > this > out. > --0016e6550dc255f3e20485045b2d--