Sha256: 97e32f449cb33b984a300557b54dff14cb99808e3e96dbe69ab71059566591b6

Contents?: true

Size: 927 Bytes

Versions: 24

Compression:

Stored size: 927 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                          # Actual
                                 ].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

24 entries across 17 versions & 10 rubygems

Version Path
cspeezy_palindrome-0.3.0 path/ruby/2.6.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
cspeezy_palindrome-0.2.0 path/ruby/2.6.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
cspeezy_palindrome-0.1.0 path/ruby/2.6.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
steenfest_palindrome-0.1.2 ruby/2.5/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
steenfest_palindrome-0.1.1b ruby/2.5/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
nullifyable-0.1.0 vendor/bundle/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
dmurphy_palindrome-0.1.0 vendor/cache/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
dmurphy_palindrome-0.1.0 vendor/cache/ruby/2.3.0/gems/dmurphy_palindrome-0.1.0/vendor/cache/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
config_gems_initialization_aim-0.1.4 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/config_gems_initialization_aim-0.1.1/vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
config_gems_initialization_aim-0.1.3 vendor/bundle/ruby/2.5.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
lgrgic_palindrome_detector-0.2.0 vendor/cache/gems/lgrgic_palindrome_detector-0.1.0/vendor/cache/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
lgrgic_palindrome_detector-0.1.0 vendor/cache/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
wfrey_palindrome-0.3.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
wfrey_palindrome-0.2.0 vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb
wfrey_palindrome-0.1.0 vendor/bundle/ruby/2.3.0/gems/wfrey_palindrome-0.1.0/vendor/bundle/ruby/2.3.0/gems/ruby-progressbar-1.10.0/lib/ruby-progressbar/time.rb