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

update to use =~ to support older versions of ruby (<2.4) #17

Merged
merged 1 commit into from
Oct 12, 2019

Conversation

cianmce
Copy link
Contributor

@cianmce cianmce commented Oct 10, 2019

Running an older version of Ruby produces the following error

bundler: failed to load command: rubocop-daemon (/Users/username/.rbenv/versions/2.2.8/bin/rubocop-daemon)
NoMethodError: undefined method `match?' for "1":String
  /Users/username/.rbenv/versions/2.2.8/lib/ruby/gems/2.2.0/gems/rubocop-daemon-0.3.1/lib/rubocop/daemon/client_command/exec.rb:31:in `exit_with_status!'
  /Users/username/.rbenv/versions/2.2.8/lib/ruby/gems/2.2.0/gems/rubocop-daemon-0.3.1/lib/rubocop/daemon/client_command/exec.rb:16:in `run'
  /Users/username/.rbenv/versions/2.2.8/lib/ruby/gems/2.2.0/gems/rubocop-daemon-0.3.1/lib/rubocop/daemon/cli.rb:38:in `create_subcommand_instance'
  /Users/username/.rbenv/versions/2.2.8/lib/ruby/gems/2.2.0/gems/rubocop-daemon-0.3.1/lib/rubocop/daemon/cli.rb:19:in `run'
  /Users/username/.rbenv/versions/2.2.8/lib/ruby/gems/2.2.0/gems/rubocop-daemon-0.3.1/exe/rubocop-daemon:8:in `<top (required)>'
  /Users/username/.rbenv/versions/2.2.8/bin/rubocop-daemon:23:in `load'
  /Users/username/.rbenv/versions/2.2.8/bin/rubocop-daemon:23:in `<top (required)>'

.match? was added in Ruby2.4 (https://www.ruby-lang.org/en/news/2016/12/25/ruby-2-4-0-released/)

This is the only place where an exclusive Ruby 2.4+ method is used

With this change, the gem works as expected on older versions. Confirmed on 2.2, 2.3 and it continues to work on 2.4+

Copy link
Owner

@fohte fohte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! LGTM.

Ruby 2.3 or under have already reached end-of-life, but rubocop-daemon does not have support policy, so maybe we should support them.

@fohte fohte merged commit b71bc16 into fohte:master Oct 12, 2019
@fohte
Copy link
Owner

fohte commented Oct 12, 2019

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.

2 participants