Class: Fixnum

Inherits:
Object
  • Object
show all
Includes:
FixnumHelper
Defined in:
lib/rubyhelper/fixnum.rb,
lib/rubyhelper/fixnum.rb

Instance Method Summary collapse

Methods included from FixnumHelper

#peer?

Instance Method Details

#+(p) ⇒ Object



24
25
26
27
# File 'lib/rubyhelper/fixnum.rb', line 24

def +(p)
  return self.to_s + p if p.is_a? String
  return self.old_add(p)
end

#old_addObject

Add the possibility to add a Fixnum with a String It will change the fixnum into a string If the argument is not a String, it will use the normal + operation



23
# File 'lib/rubyhelper/fixnum.rb', line 23

alias_method :old_add, :+