Class Time
In: lib/mack-facets/extensions/time.rb
Parent: Object

Methods

random   to_date   to_datetime  

Public Class methods

Generates a random Time between the start time and the end time.

[Source]

    # File lib/mack-facets/extensions/time.rb, line 26
26:   def self.random(start_time, end_time = Time.now)
27:     start_time + (rand(end_time - start_time).to_i)
28:   end

Public Instance methods

[Source]

    # File lib/mack-facets/extensions/time.rb, line 7
 7:       def to_date
 8:         require 'date' # just in case
 9:         jd = Date.__send__(:civil_to_jd, year, mon, mday, Date::ITALY)
10:         Date.new!(Date.__send__(:jd_to_ajd, jd, 0, 0), 0, Date::ITALY)
11:       end

[Source]

    # File lib/mack-facets/extensions/time.rb, line 19
19:       def to_datetime
20:         raise NoMethodError.new("to_datetime")
21:       end

[Validate]