Skip to content

Instantly share code, notes, and snippets.

@dennyabraham
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennyabraham/9400684 to your computer and use it in GitHub Desktop.
Save dennyabraham/9400684 to your computer and use it in GitHub Desktop.
odd jruby behavior
# ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.5.0]
irb(main):001:0> y = "100000"
"100000"
irb(main):002:0> y.class
String < Object
irb(main):003:0> y[3] = '-'
"-"
irb(main):004:0> y
"100-00"
irb(main):005:0> x = 100000.to_s
"100000"
irb(main):006:0> x.class
String < Object
irb(main):007:0> x[3] = '-'
"-"
irb(main):008:0> x
"100-00"
# jruby 1.7.2 (1.9.3p327) 2013-01-04 302c706 on Java HotSpot(TM) 64-Bit Server VM 1.7.0_12-ea-b08 +indy [darwin-x86_64]
irb(main):001:0> y = "100000"
=> "100000"
irb(main):002:0> y.class
=> String
irb(main):003:0> y[3] = '-'
=> "-"
irb(main):004:0> y
=> "100-00"
irb(main):005:0> x = 100000.to_s
=> "100000"
irb(main):006:0> x.class
=> String
irb(main):007:0> x[3] = '-'
=> "-"
irb(main):008:0> x
=> "100000"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment