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 runs-on: ubuntu-18.04
strategy: strategy:
matrix: matrix:
ruby: [2.4, 2.5, 2.6, 2.7] ruby: [2.4, 2.5, 2.6, 2.7, 3.0]
steps: steps:
- uses: actions/checkout@master - 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 # from explictly defined procs/lambdas, so we can't deduce the number of
# parameters from the array length. Instead, look for an unnamed # parameters from the array length. Instead, look for an unnamed
# parameter in the first position just pass the record as the receiver obj. # 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) proc.call(params.first)
else else
proc.call(*params.take(proc.parameters.length)) proc.call(*params.take(proc.parameters.length))

View File

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

View File

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

View File

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