class ProgressBar::Time

Constants

TIME_MOCKING_LIBRARY_METHODS

Attributes

time[RW]

Public Class Methods

new(time = ::Time) click to toggle source
# File lib/ruby-progressbar/time.rb, line 11
def initialize(time = ::Time)
  self.time = time
end

Public Instance Methods

now() click to toggle source
# File lib/ruby-progressbar/time.rb, line 15
def now
  time.__send__(unmocked_time_method)
end
unmocked_time_method() click to toggle source
# File lib/ruby-progressbar/time.rb, line 19
def unmocked_time_method
  @unmocked_time_method ||= begin
                              TIME_MOCKING_LIBRARY_METHODS.find do |method|
                                time.respond_to? method
                              end
                            end
end