Module: Basic101::BasicMath
- Included in:
- BasicNumeric
- Defined in:
- lib/basic101/basic_math.rb
Class Method Summary collapse
Class Method Details
.basic_math_op(method) ⇒ Object
7 8 9 10 11 12 13 14 |
# 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 |