Fix rubocop complaints

This commit is contained in:
Robert Lockerd 2020-12-28 09:01:13 +13:00
parent a093837e99
commit b430975cc9
5 changed files with 5 additions and 9 deletions

View File

@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-18.04
strategy:
matrix:
ruby: [2.4, 2.5, 2.6, 2.7]
ruby: [2.4, 2.5, 2.6, 2.7, 3.0]
steps:
- uses: actions/checkout@master

View File

@ -10,7 +10,7 @@ module FastJsonapi
# from explictly defined procs/lambdas, so we can't deduce the number of
# parameters from the array length. Instead, look for an unnamed
# parameter in the first position just pass the record as the receiver obj.
if proc.parameters.length > 0 && proc.parameters.first[1].nil?
if proc.parameters.positive? && !proc.parameters.empty?
proc.call(params.first)
else
proc.call(*params.take(proc.parameters.length))

View File

@ -12,12 +12,7 @@ module FastJsonapi
object_block:,
serializer:,
relationship_type:,
cached: false,
polymorphic:,
conditional_proc:,
transform_method:,
links:,
meta:,
polymorphic:, conditional_proc:, transform_method:, links:, meta:, cached: false,
lazy_load_data: false
)
@owner = owner

View File

@ -3,6 +3,7 @@
module JSONAPI
module Serializer
class Error < StandardError; end
class UnsupportedIncludeError < Error
attr_reader :include_item, :klass

View File

@ -50,7 +50,7 @@ class MovieSerializer
attribute :released_in_year, &:year
attributes :name
attribute :release_year do |object, params|
attribute :release_year do |object, _params|
object.year
end