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
mux_ruby-3.20.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.19.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.18.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.17.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.15.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
avalara_sdk-24.2.29 vendor/bundle/ruby/2.7.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.14.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.13.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.12.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.11.1 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
mux_ruby-3.11.0 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cybrid_api_organization_ruby-0.62.65 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cybrid_api_bank_ruby-0.62.65 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cybrid_api_id_ruby-0.62.65 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb
cybrid_api_organization_ruby-0.62.64 vendor/bundle/ruby/3.2.0/gems/ruby-progressbar-1.11.0/lib/ruby-progressbar/time.rb