On Sep 7, 10:52  宮
> Hi,
>
> On Sep 7, 2008, at 9:05 AM, Trans wrote:
>
> > def grumpize
> > to_self(to_s.upcase + '!!!!!!!!!')
> > end
>
> This is a bit of a confusing idiom, especially when expanded:
>
>   
>
> You may make yourself slightly clearer with a block method. A > simplified example:
>
>   
>   >  
>    >    >  
>  
>  
>
>  
>   
>   󧡡>  
>  
>
> It's cleanest to just define String#grumpize and Symbol#grumpize > individually.

Ah, that helps me "cleanest" my thoughts. It occurs to me that while
#to_self() makes sense in this context, it may differ depending on the
mixin used. For example:

  class Integer
    include Grumpy
  end

That could work, but if to_self is used there will be issues clearly
(!!!!!!!!! ain't a number). Hence, what I'm really after is an
optional method that can be defined when needed to say "how to become
grumpy". Then:

  module Grumpy
    def make_grumpy(obj)
      obj
    end

    def grumpize
      make_grumpy(to_s.upcase + '!!!!!!!!!')
    end
  end

  class Symbol
    include Grumpy
    def make_grumpy(obj)
      obj.to_sym
    end
  end

T.