From: Josh Cheek Date: 2013-02-19T12:45:55+09:00 Subject: Re: Adding camelize and underscore to String --f46d040890c1a1401604d60bad58 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Feb 18, 2013 at 9:23 PM, tamouse mailing lists < tamouse.lists@gmail.com> wrote: > > I do this a bit differently: > > class String > def camelize > self = self.dup > self.camelize! > end > Should just be: def camelize dup.camelize! end > module Camelizer > # method defs as above > end > > String.send(:include Camelizer) > > Hmm. I assume what you meant to do was `string.extend(Camelizer)` because otherwise, what's the point of pulling it out into its own module? Every string gets it anyway b/c it's included into the String class, and no one else can use it because it only makes sense on Strings. --f46d040890c1a1401604d60bad58 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Mon, Feb 18, 2013 at 9:23 PM, tamouse mailing lists &l= t;tamouse.list= s@gmail.com> wrote:

I do this a bit differently:

class String
=A0 def camelize
=A0 =A0 self =3D self.dup
=A0 =A0 self.camelize!
=A0 end


Should just be:<= /div>
def camelize
=A0 dup.camelize!
end
=

module Camelizer
=A0 # method defs as above
end

String.send(:include Camelizer)


Hmm. I assume what you meant to do was `string.= extend(Camelizer)` because otherwise, what's the point of pulling it ou= t into its own module? Every string gets it anyway b/c it's included in= to the String class, and no one else can use it because it only makes sense= on Strings.
--f46d040890c1a1401604d60bad58--