Created
June 5, 2012 21:43
-
-
Save kouno/2878246 to your computer and use it in GitHub Desktop.
Inheritance of BigDecimal breaks is_a? function in JRuby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bigdecimal" | |
class Decimal < BigDecimal | |
end | |
# Inheritance breaks is_a? function | |
# Decimal.new("9876543210").is_a?(Decimal) | |
# => false | |
# jruby 1.6.7.2 (ruby-1.8.7-p357) (2012-05-01 26e08ba) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java] | |
puts "Decimal.new is a Decimal object?: #{Decimal.new("9876543210").is_a?(Decimal)}" | |
class SubString < String | |
end | |
# Inheriting from String works as expected. | |
puts "SubString.new is a SubString object?: #{SubString.new("test").is_a?(SubString)}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment