-
-
Save dekz/2878757 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
~/tmp % jruby -v | |
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java] | |
~/tmp % jruby zz.rb | |
Decimal.new is a Decimal object?: false | |
SubString.new is a SubString object?: true |
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
~/tmp % jruby -v | |
jruby 1.6.7 (ruby-1.8.7-p357) (2012-02-22 3e82bc8) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java] | |
~/tmp % jruby --1.9 zz.rb | |
Decimal.new is a Decimal object?: false | |
SubString.new is a SubString object?: true |
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
~/tmp % jruby -v | |
jruby 1.7.0.preview1 (ruby-1.9.3-p203) (2012-05-19 00c8c98) (Java HotSpot(TM) 64-Bit Server VM 1.6.0_31) [darwin-x86_64-java] | |
~/tmp % jruby zz.rb | |
Decimal.new is a Decimal object?: false | |
SubString.new is a SubString object?: true |
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
~/tmp % ruby -v | |
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0] | |
~/tmp % ruby zz.rb | |
Decimal.new is a Decimal object?: true | |
SubString.new is a SubString object?: true |
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
~/tmp % ruby -v | |
rubinius 2.0.0dev (1.8.7 4f53f0ce yyyy-mm-dd JI) [x86_64-apple-darwin11.3.0] | |
~/tmp % ruby zz.rb | |
Decimal.new is a Decimal object?: true | |
SubString.new is a SubString object?: true |
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 | |
puts "Decimal.new is a Decimal object?: #{Decimal.new("9876543210").is_a?(Decimal)}" | |
class SubString < String | |
end | |
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