Module: TimeRounder

Defined in:
lib/time_rounder.rb,
lib/time_rounder/version.rb,
lib/time_rounder/rounded_time.rb,
lib/time_rounder/rounded_time_from_seconds.rb

Overview

Takes seconds and returns a decimal of hours and partial hours.

Defined Under Namespace

Classes: RoundedTime, RoundedTimeFromSeconds

Constant Summary collapse

VERSION =
"0.2.1"

Class Method Summary collapse

Class Method Details

.rounded_time(time) ⇒ Object

Takes a DateTime/Time object and returns the time to the nearest quarter hour



20
21
22
# File 'lib/time_rounder.rb', line 20

def self.rounded_time(time)
  TimeRounder::RoundedTime.new(time).rounded_time
end

.seconds_to_hours(seconds) ⇒ Object

Takes number of seconds and returns hours and partial hours in decimal form.



13
14
15
# File 'lib/time_rounder.rb', line 13

def self.seconds_to_hours(seconds)
  TimeRounder::RoundedTimeFromSeconds.new(seconds).rounded_time
end