Skip to content

Commit

Permalink
Revert "Better: Add ruby 3.1 compatibility."
Browse files Browse the repository at this point in the history
This reverts commit e3b4c9f.
  • Loading branch information
joshuacronemeyer committed Aug 10, 2023
1 parent e3b4c9f commit 4cb5072
Showing 1 changed file with 4 additions and 12 deletions.
16 changes: 4 additions & 12 deletions lib/timecop/time_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,16 @@ def mock_time

alias_method :now_without_mock_time, :now

def now_with_mock_time(*args)
mock_time || now_without_mock_time(*args)
def now_with_mock_time
mock_time || now_without_mock_time
end

alias_method :now, :now_with_mock_time

alias_method :new_without_mock_time, :new

def new_with_mock_time(*args, **kwargs)
if args.size <= 0
now(*args)
else
if kwargs == {}
new_without_mock_time(*args)
else
new_without_mock_time(*args, **kwargs)
end
end
def new_with_mock_time(*args)
args.size <= 0 ? now : new_without_mock_time(*args)
end

ruby2_keywords :new_with_mock_time if Module.private_method_defined?(:ruby2_keywords)
Expand Down

0 comments on commit 4cb5072

Please sign in to comment.