Fix rubocop complaints
This commit is contained in:
parent
a093837e99
commit
b430975cc9
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@ -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
|
||||||
|
@ -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))
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
2
spec/fixtures/movie.rb
vendored
2
spec/fixtures/movie.rb
vendored
@ -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
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user