Sha256: f078824997646db1a980b54c8e8b733fa500d64c358b3e15abe6c52259377338
Contents?: true
Size: 381 Bytes
Versions: 3
Compression:
Stored size: 381 Bytes
Contents
module Basic101 module BasicMath 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 basic_math_op :* basic_math_op :/ basic_math_op :+ basic_math_op :- basic_math_op :** end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
basic101-0.4.0 | lib/basic101/basic_math.rb |
basic101-0.2.0 | lib/basic101/basic_math.rb |
basic101-0.1.0 | lib/basic101/basic_math.rb |