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

Fix Syntax Error in ice_cube gem for Ruby 3.0+ Compatibility #561

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

codxse
Copy link

@codxse codxse commented Sep 23, 2024

This pull request addresses a syntax error in the ice_cube gem that occurs when using Ruby 3.0 or later. The error is caused by the use of a shorthand syntax for block parameters that is not supported in earlier Ruby versions.

Current Error

SyntaxError:
       /usr/local/bundle/bundler/gems/ice_cube-db4715e37368/lib/ice_cube/schedule.rb:163: syntax error, unexpected ')', expecting local variable or method
           def each_occurrence(&)
                                ^
       /usr/local/bundle/bundler/gems/ice_cube-db4715e37368/lib/ice_cube/schedule.rb:164: syntax error, unexpected ')'
       ...rate_occurrences(start_time, &).to_a
       ...                              ^
       /usr/local/bundle/bundler/gems/ice_cube-db4715e37368/lib/ice_cube/schedule.rb:502: syntax error, unexpected `end', expecting end-of-input

This PR modifies the each_occurrence method to use the traditional block syntax, which is compatible with both older and newer Ruby versions. The changes are as follows:

# Old code
def each_occurrence(&)
  generate_occurrences(start_time, &).to_a
end

# New code
def each_occurrence(&block)
  generate_occurrences(start_time, &block).to_a
end

This change maintains the functionality while ensuring compatibility across Ruby versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant