Sha256: c7d23e9230911607480233e8a7ae1ed4ab65c57d0564be18dcbf43c698a18cb2

Contents?: true

Size: 610 Bytes

Versions: 3

Compression:

Stored size: 610 Bytes

Contents

class   ProgressBar
class   Time
  def self.now(time = ::Time)
    @time = time

    @time.send unmocked_time_method
  end

  def self.unmocked_time_method
    @unmocked_time_method ||= begin
                                time_mocking_library_methods.find do |method|
                                  @time.respond_to? method
                                end
                              end
  end

  def self.time_mocking_library_methods
    [
      :now_without_mock_time,       # Timecop
      :now_without_delorean,        # Delorean
      :now                          # Actual
    ]
  end
end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-progressbar-1.7.5 lib/ruby-progressbar/time.rb
ruby-progressbar-1.7.1 lib/ruby-progressbar/time.rb
ruby-progressbar-1.7.0 lib/ruby-progressbar/time.rb