module Basic101::BasicMath

Public Class Methods

basic_math_op(method) click to toggle source
# File lib/basic101/basic_math.rb, line 7
def self.basic_math_op(method)
  define_method(method) do |other|
    a = to_float.to_f
    b = other.to_float.to_f
    result = a.send(method, b)
    BasicFloat.new(result).simplest
  end
end