On 13/09/2011, at 9:27 AM, SASADA Koichi wrote:
> I find out that bitwise operation doesn't call coerce.
> How to make mimic Integer class?

The short answer: You can't.

The long answer:

You can imitate some of the behaviour of Integers, but when you
get into hashing and numeric operations, the different Ruby
interpreters all have different shortcuts that prevent your custom
code from being called.

See this post for more information:
=
<http://blog.rubybestpractices.com/posts/rklemme/019-Complete_Numeric_Clas=
s.html>

And a discussion thread that I started:
<http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/381087>

Clifford Heath.=