class Numeric

Public Instance Methods

method_missing(m, *params) click to toggle source

Patched method method_missing in order to generate a SHAUN number if the method called looks like an attribute reader

Calls superclass method
# File lib/shaun.rb, line 140
def method_missing(m, *params)
  res = m.match /([a-zA-Z_][a-zA-Z0-9_]*)/
  if res and params.empty?
    unit = res[1].to_s
    Shaun::Number.new self, unit
  else
    super m, *params
  end
end
to_sn() click to toggle source

Cast to a SHAUN number

# File lib/shaun.rb, line 134
def to_sn
  Shaun::Number.new self
end