unless (RUBY_VERSION[0,3] == '1.9') class NilClass # Allows nil to respond to #to_f. # Always returns 0. # # nil.to_f #=> 0.0 # # CREDIT: Matz def to_f; 0.0; end end end