Sha256: 89c010ceea2abe9e2fb51dd322c51dce884b71fa143f7d73a826e51d01420617

Contents?: true

Size: 910 Bytes

Versions: 2660

Compression:

Stored size: 910 Bytes

Contents

# rubocop:disable Style/InlineComment
class   ProgressBar
class   Time
  TIME_MOCKING_LIBRARY_METHODS = [
                                   :__simple_stub__now,     # ActiveSupport
                                   :now_without_mock_time,  # Timecop
                                   :now_without_delorean,   # Delorean
                                   :now                     # Unmocked
                                 ].freeze

  def initialize(time = ::Time)
    self.time = time
  end

  def now
    time.__send__(unmocked_time_method)
  end

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

  protected

  attr_accessor :time
end
end
# rubocop:enable Style/InlineComment

Version data entries

2,660 entries across 2,618 versions & 34 rubygems

Version Path
josufst_palindrome-0.1.1 vendor/cache/ruby/2.6.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.8 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.7 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.6/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.7 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.6 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.3/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.4 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.2/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.2 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.2 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.1 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.1 vendor/cache/ruby/2.7.0/gems/paynow_sdk-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
paynow_sdk-0.1.0 vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
files.com-1.0.1 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb
chikari_palindrome-0.1.0 vendor/cache/ruby/2.7.0/gems/chikari_palindrome-0.1.0/vendor/cache/ruby/2.7.0/gems/ruby-progressbar-1.10.1/lib/ruby-progressbar/time.rb