Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Better: Add ruby 3.1 compatibility." #405

Merged
merged 1 commit into from
Aug 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Revert "Better: Add ruby 3.1 compatibility."
This reverts commit e3b4c9f.
  • Loading branch information
joshuacronemeyer authored Aug 10, 2023
commit 168cf762d3a9315b8c02b996a435ab18581be59d
16 changes: 4 additions & 12 deletions lib/timecop/time_extensions.rb
Original file line number Diff line number Diff line change
@@ -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)