Class: Numeric
- Inherits:
-
Object
- Object
- Numeric
- Defined in:
- lib/osc-ruby/core_ext/numeric.rb
Instance Method Summary collapse
- #days ⇒ Object
- #hours ⇒ Object
-
#milliseconds ⇒ Object
Convert time intervals to seconds.
- #minutes ⇒ Object
- #seconds ⇒ Object
- #to_days ⇒ Object
- #to_hours ⇒ Object
-
#to_milliseconds ⇒ Object
Convert seconds to other intervals.
- #to_minutes ⇒ Object
- #to_seconds ⇒ Object
- #to_weeks ⇒ Object
- #weeks ⇒ Object
Instance Method Details
#days ⇒ Object
7 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 7 def days; self*60*60*24; end |
#hours ⇒ Object
6 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 6 def hours; self*60*60; end |
#milliseconds ⇒ Object
Convert time intervals to seconds
3 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 3 def milliseconds; self/1000.0; end |
#minutes ⇒ Object
5 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 5 def minutes; self*60; end |
#seconds ⇒ Object
4 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 4 def seconds; self; end |
#to_days ⇒ Object
15 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 15 def to_days; self/(60*60*24.0); end |
#to_hours ⇒ Object
14 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 14 def to_hours; self/(60*60.0); end |
#to_milliseconds ⇒ Object
Convert seconds to other intervals
11 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 11 def to_milliseconds; self*1000; end |
#to_minutes ⇒ Object
13 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 13 def to_minutes; self/60.0; end |
#to_seconds ⇒ Object
12 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 12 def to_seconds; self; end |
#to_weeks ⇒ Object
16 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 16 def to_weeks; self/(60*60*24*7.0); end |
#weeks ⇒ Object
8 |
# File 'lib/osc-ruby/core_ext/numeric.rb', line 8 def weeks; self*60*60*24*7; end |