Is it intentional?

###

class IntegerMimic
  def initialize n
    @n = n
  end

  def to_int
    @n
  end
end

obj = IntegerMimic.new(10)

%w(& | ^).each{|sym|
  p sym
  begin
    p(3.send(sym, obj))
  rescue => e
    p e
  end
}

#=>
ruby 1.9.4dev (2011-09-11 trunk 33248) [i386-mswin32_100]
"&"
#<TypeError: can't convert IntegerMimic into Integer for bitwise arithmetic>
"|"
#<TypeError: can't convert IntegerMimic into Integer for bitwise arithmetic>
"^"
#<TypeError: can't convert IntegerMimic into Integer for bitwise arithmetic>


(2011/08/29 7:25), Kenta Murata wrote:
> 
> Issue #1792 has been updated by Kenta Murata.
> 
> Status changed from Assigned to Closed
> 
> ごめんなさいごめんなさい。
> r33113 で修正しました。
> 
> ----------------------------------------
> Bug #1792: Fixnum#& 等が、Rational などを受けつける
> http://redmine.ruby-lang.org/issues/1792
> 
> Author: tadayoshi funaba
> Status: Closed
> Priority: Normal
> Assignee: Kenta Murata
> Category: 
> Target version: 1.9.x
> ruby -v: -
> 
> 
> =begin
>  1 & 1.5 がエラーになるので、
>  1 & Rational(3,2)
>  
>  1 & BigDecimal('1.5')
>  もエラーにすべきかもしれません。
> =end
> 
> 
> 


-- 
// SASADA Koichi at atdot dot net