Skip to content

Commit

Permalink
Require Rails 6+ and Ruby 2.7+ (#15)
Browse files Browse the repository at this point in the history
Avoid monkey patching `Array#intersection` and hacks in action cable javascript loading
  • Loading branch information
westonganger committed Jan 20, 2024
1 parent bc90828 commit 7a10e2a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 23 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,16 @@ jobs:
matrix:
include:
### TEST RUBY VERSIONS
- ruby: "2.5"
- ruby: "2.6"
- ruby: "2.7"
- ruby: "3.0"
- ruby: "3.1"
- ruby: "3.2"
- ruby: "3.3"
### TEST RAILS VERSIONS
- ruby: "2.6"
env:
RAILS_VERSION: "5.2"
- ruby: "2.6"
- ruby: "2.7"
env:
RAILS_VERSION: "6.0"
- ruby: "2.6"
- ruby: "2.7"
env:
RAILS_VERSION: "6.1"
- ruby: "3.3"
Expand Down
8 changes: 1 addition & 7 deletions app/views/pairer/boards/_action_cable_script.html.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<% if Rails::VERSION::MAJOR == 5 %>
<script src="https://cdn.jsdelivr.net/npm/actioncable@<%= Rails::VERSION::STRING.split(".")[0..2].join(".") %>/lib/assets/compiled/action_cable.min.js"></script>
<% end %>

<script type="module">
<% if Rails::VERSION::MAJOR >= 6 %>
import * as ActionCable from "https://cdn.jsdelivr.net/npm/@rails/actioncable@<%= Rails::VERSION::STRING.split(".")[0..2].join(".") %>/+esm";
<% end %>
import * as ActionCable from "https://cdn.jsdelivr.net/npm/@rails/actioncable@<%= Rails::VERSION::STRING.split(".")[0..2].join(".") %>/+esm";

var consumer = ActionCable.createConsumer();

Expand Down
8 changes: 0 additions & 8 deletions lib/pairer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ def self.config(&block)
end

end

if RUBY_VERSION.to_f <= 2.6 && !Array.new.respond_to?(:intersection)
Array.class_eval do
def intersection(other)
self & other
end
end
end
4 changes: 3 additions & 1 deletion pairer.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Gem::Specification.new do |spec|

spec.files = Dir["{app,config,db,lib,public}/**/*", "LICENSE", "Rakefile", "README.md"]

spec.add_dependency "rails", ">= 5.0"
spec.required_ruby_version = ">= 2.7"

spec.add_dependency "rails", ">= 6.0"
spec.add_dependency "actioncable"
spec.add_dependency "slim"
spec.add_dependency "hashids"
Expand Down

0 comments on commit 7a10e2a

Please sign in to comment.