Skip to content

Commit 2fa7b50

Browse files
Merge pull request #1 from monade/modern-ruby-support
Modern ruby support
2 parents 55df2b7 + 9068354 commit 2fa7b50

File tree

6 files changed

+17
-13
lines changed

6 files changed

+17
-13
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
ruby: [2.4, 2.7, '3.0', 3.1, 3.2, truffleruby-head]
11+
ruby: [2.7, '3.0', 3.1, 3.2, 3.3, 3.4, head, truffleruby-head]
1212

1313
steps:
1414
- uses: actions/checkout@v3
@@ -22,13 +22,13 @@ jobs:
2222
run: |
2323
sudo apt-get install libsqlite3-dev
2424
25-
- name: Install legacy bundler for Ruby 2.4
26-
if: ${{ matrix.ruby == 2.4 }}
25+
- name: Install legacy bundler for Ruby 2.7
26+
if: ${{ matrix.ruby == 2.7 }}
2727
run: |
28-
gem install -q bundler -v 2.3.26
28+
gem install -q bundler -v 2.4.22
2929
30-
- name: Install bundler 2.4+ for modern Rubies
31-
if: ${{ matrix.ruby != 2.4 }}
30+
- name: Install bundler 2.7+ for modern Rubies
31+
if: ${{ matrix.ruby != 2.7 }}
3232
run: |
3333
gem install -q bundler
3434

.rubocop.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require:
1+
plugins:
22
- rubocop-performance
33
- rubocop-rspec
44

@@ -23,7 +23,10 @@ Lint/DuplicateMethods:
2323
Exclude:
2424
- 'spec/fixtures/*.rb'
2525

26-
RSpec/FilePath:
26+
RSpec/SpecFilePathFormat:
27+
Enabled: false
28+
29+
RSpec/SpecFilePathSuffix:
2730
Enabled: false
2831

2932
RSpec/DescribedClass:
@@ -76,7 +79,7 @@ Layout/LineLength:
7679
Exclude:
7780
- 'lib/**/**.rb'
7881

79-
Naming/PredicateName:
82+
Naming/PredicatePrefix:
8083
Exclude:
8184
- 'lib/**/**.rb'
8285

jsonapi-serializer.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
1919
gem.require_paths = ['lib']
2020
gem.extra_rdoc_files = ['LICENSE.txt', 'README.md']
2121

22-
gem.add_runtime_dependency('activesupport', '>= 4.2')
22+
gem.add_dependency('activesupport', '>= 4.2')
2323

2424
gem.add_development_dependency('activerecord')
2525
gem.add_development_dependency('bundler')

lib/fast_jsonapi/object_serializer.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def is_collection?(resource, force_is_collection = nil)
117117
end
118118

119119
def inherited(subclass)
120-
super(subclass)
120+
super
121121
subclass.attributes_to_serialize = attributes_to_serialize.dup if attributes_to_serialize.present?
122122
subclass.relationships_to_serialize = relationships_to_serialize.dup if relationships_to_serialize.present?
123123
subclass.cachable_relationships_to_serialize = cachable_relationships_to_serialize.dup if cachable_relationships_to_serialize.present?
@@ -271,7 +271,7 @@ def create_relationship(base_key, relationship_type, options, block)
271271
name: name,
272272
id_method_name: compute_id_method_name(
273273
options[:id_method_name],
274-
"#{base_serialization_key}#{id_postfix}".to_sym,
274+
:"#{base_serialization_key}#{id_postfix}",
275275
polymorphic,
276276
options[:serializer],
277277
block

spec/fixtures/actor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Actor < User
66
attr_accessor :movies, :movie_ids
77

88
def self.fake(id = nil)
9-
faked = super(id)
9+
faked = super
1010
faked.movies = []
1111
faked.movie_ids = []
1212
faked

spec/spec_helper.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
end
99

1010
require 'active_support'
11+
require 'active_support/core_ext/object'
1112
require 'active_support/core_ext/object/json'
1213
require 'jsonapi/serializer'
1314
require 'ffaker'

0 commit comments

Comments
 (0)