ruby 1.8.7 (2010-12-23, уровень обновления 330) [i686-darwin10.5.0]
Я что-то упустил?
module Mixin
def is_a?(o)
return false if o == Hash
super
end
alias_method :kind_of?, :is_a?
end
class Doc < Hash
include Mixin
end
puts Doc.new().is_a?(Doc) # => true
puts Doc.new().kind_of?(Doc) # => super: no superclass method `is_a?'
Ожидается:
puts Doc.new().is_a?(Doc) # => true
puts Doc.new().kind_of?(Doc) # => true
puts Doc.new().is_a?(Hash) # => false
puts Doc.new().kind_of?(Hash) # => false
На рубине и рубине все круто 1.9.2p136