Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/formulae/run/excel_functions.rb

Instance Method Summary collapse

Instance Method Details

#*(other) ⇒ Object



13
# File 'lib/formulae/run/excel_functions.rb', line 13

def *(other) (other.number_like? && number_like?) ? self.to_f * other : self.old_multiply(other) end

#+(other) ⇒ Object



11
# File 'lib/formulae/run/excel_functions.rb', line 11

def +(other) (other.number_like? && number_like?) ? self.to_f + other : self.old_plus(other) end

#+@Object



7
# File 'lib/formulae/run/excel_functions.rb', line 7

def +@; number_like? ? self.to_f : self; end

#-(other) ⇒ Object



12
# File 'lib/formulae/run/excel_functions.rb', line 12

def -(other) (other.number_like? && number_like?) ? self.to_f - other : :value end

#-@Object



8
# File 'lib/formulae/run/excel_functions.rb', line 8

def -@; number_like? ? -self.to_f : self; end

#/(other) ⇒ Object



14
# File 'lib/formulae/run/excel_functions.rb', line 14

def /(other) (other.number_like? && number_like?) ? self.to_f / other : :value end

#coerce(other) ⇒ Object



15
# File 'lib/formulae/run/excel_functions.rb', line 15

def coerce(other); number_like? ? self.to_f.coerce(other) : [other,:value]; end

#number_like?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/formulae/run/excel_functions.rb', line 16

def number_like?
  self =~ /^\d+\.?\d*$/
end

#old_multiplyObject



10
# File 'lib/formulae/run/excel_functions.rb', line 10

alias old_multiply *

#old_plusObject



9
# File 'lib/formulae/run/excel_functions.rb', line 9

alias old_plus +