On Wed, Jan 12, 2011 at 2:10 AM, Rodrigo Rosenfeld Rosas
<rr.rosas / gmail.com> wrote:
> =A0Whatever what name is chosen, shouldn't we also define another method =
like
> Object#from so that Object#to would be implemented as below?
>
> def to(klass)
> =A0 =A0klass.from(self)
> end
>
> Rodrigo
>
> Em 11-01-2011 14:46, Haase, Konstantin escreveu:
>>
>> Both #as (Parslet, Sequel, MetaWhere, hacketyhack, Facets, Ruport,
>> CouchPotato, ...) and #to (RSpec, Ramaze, ActiveSupport) are use in DSLs=
.
>> However, I really prefer #to.
>>
>> Konstantin
>>
>> On Jan 11, 2011, at 17:39 , Rodrigo Rosenfeld Rosas wrote:
>
>
>

+1. Good Idea.

* Object#to(klass, *args)
* Class.from(obj, *args)
##

"10".to(Integer) #=3D> 10
Integer.from("10") #=3D> 10

10.to(String, 8) #=3D> "12"
String.from(10, 8) #=3D> "12"

##
--=20
Shota Fukumori a.k.a. @sora_h - http://codnote.net/