Module: NumTools
- Included in:
- Stopwatch
- Defined in:
- lib/walltime.rb
Overview
Author: Brian Hood
Description: Walltime
A stopwatch project for all kinds of things
Class Method Summary collapse
Instance Method Summary collapse
-
#random_between(min, max) ⇒ Object
Implement more if you wish only interested in round myself right now.
Class Method Details
.define_component(name) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/walltime.rb', line 16 def self.define_component(name) name_func = name.to_s.gsub("_to", "").to_sym define_method(name) do |val, x| (val * 10**x).send("#{name_func}").to_f / 10**x end end |
Instance Method Details
#random_between(min, max) ⇒ Object
Implement more if you wish only interested in round myself right now.
14 |
# File 'lib/walltime.rb', line 14 def random_between(min, max); min+rand(max); end |