Sometimes I see code with to_d . The ruby document even indicates there is a Float#to_d . However, this is not in my version of ruby ( ruby 1.9.3p263 (2012-08-23 revision 36792 ).
1.9.3p263 :001 > "0.0".to_d NoMethodError: undefined method `to_d' for "0.0":String from (irb):1 from /home/iblue/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>' 1.9.3p263 :002 > 0.0.to_d NoMethodError: undefined method `to_d' for 0.0:Float from (irb):2 from /home/iblue/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>' 1.9.3p263 :003 > 0.to_d NoMethodError: undefined method `to_d' for 0:Fixnum from (irb):3 from /home/iblue/.rvm/rubies/ruby-1.9.3-head/bin/irb:16:in `<main>'
No to_d in Float , String or Fixnum . What's happening?
ruby
iblue
source share