Make rubocop happy.
This commit is contained in:
parent
c5eb1ce27c
commit
ef93f7f358
21
.rubocop.yml
21
.rubocop.yml
@ -2,6 +2,10 @@ require:
|
||||
- rubocop-performance
|
||||
- rubocop-rspec
|
||||
|
||||
AllCops:
|
||||
NewCops: enable
|
||||
SuggestExtensions: false
|
||||
|
||||
Style/FrozenStringLiteralComment:
|
||||
Enabled: false
|
||||
|
||||
@ -76,3 +80,20 @@ Naming/PredicateName:
|
||||
Naming/AccessorMethodName:
|
||||
Exclude:
|
||||
- 'lib/**/**.rb'
|
||||
|
||||
Style/CaseLikeIf:
|
||||
Exclude:
|
||||
- 'lib/fast_jsonapi/object_serializer.rb'
|
||||
|
||||
Style/OptionalBooleanParameter:
|
||||
Exclude:
|
||||
- 'lib/fast_jsonapi/serialization_core.rb'
|
||||
- 'lib/fast_jsonapi/relationship.rb'
|
||||
|
||||
Lint/DuplicateBranch:
|
||||
Exclude:
|
||||
- 'lib/fast_jsonapi/relationship.rb'
|
||||
|
||||
Style/DocumentDynamicEvalDefinition:
|
||||
Exclude:
|
||||
- 'lib/extensions/has_one.rb'
|
||||
|
@ -228,10 +228,10 @@ module FastJsonapi
|
||||
|
||||
# TODO: Remove this undocumented option.
|
||||
# Delegate the caching to the serializer exclusively.
|
||||
if !relationship.cached
|
||||
uncachable_relationships_to_serialize[relationship.name] = relationship
|
||||
else
|
||||
if relationship.cached
|
||||
cachable_relationships_to_serialize[relationship.name] = relationship
|
||||
else
|
||||
uncachable_relationships_to_serialize[relationship.name] = relationship
|
||||
end
|
||||
relationships_to_serialize[relationship.name] = relationship
|
||||
end
|
||||
@ -302,7 +302,7 @@ module FastJsonapi
|
||||
|
||||
def serializer_for(name)
|
||||
namespace = self.name.gsub(/()?\w+Serializer$/, '')
|
||||
serializer_name = name.to_s.demodulize.classify + 'Serializer'
|
||||
serializer_name = "#{name.to_s.demodulize.classify}Serializer"
|
||||
serializer_class_name = namespace + serializer_name
|
||||
begin
|
||||
serializer_class_name.constantize
|
||||
@ -340,7 +340,7 @@ module FastJsonapi
|
||||
def validate_includes!(includes)
|
||||
return if includes.blank?
|
||||
|
||||
parse_includes_list(includes).keys.each do |include_item|
|
||||
parse_includes_list(includes).each_key do |include_item|
|
||||
relationship_to_include = relationships_to_serialize[include_item]
|
||||
raise(JSONAPI::Serializer::UnsupportedIncludeError.new(include_item, name)) unless relationship_to_include
|
||||
|
||||
|
@ -12,7 +12,12 @@ module FastJsonapi
|
||||
object_block:,
|
||||
serializer:,
|
||||
relationship_type:,
|
||||
polymorphic:, conditional_proc:, transform_method:, links:, meta:, cached: false,
|
||||
polymorphic:,
|
||||
conditional_proc:,
|
||||
transform_method:,
|
||||
links:,
|
||||
meta:,
|
||||
cached: false,
|
||||
lazy_load_data: false
|
||||
)
|
||||
@owner = owner
|
||||
|
@ -8,6 +8,7 @@ module JSONAPI
|
||||
attr_reader :include_item, :klass
|
||||
|
||||
def initialize(include_item, klass)
|
||||
super()
|
||||
@include_item = include_item
|
||||
@klass = klass
|
||||
end
|
||||
|
2
spec/fixtures/movie.rb
vendored
2
spec/fixtures/movie.rb
vendored
@ -26,7 +26,7 @@ class Movie
|
||||
@url ||= FFaker::Internet.http_url
|
||||
return @url if obj.nil?
|
||||
|
||||
@url + '?' + obj.hash.to_s
|
||||
"#{@url}?#{obj.hash}"
|
||||
end
|
||||
|
||||
def owner=(ownr)
|
||||
|
@ -10,10 +10,8 @@ RSpec.describe JSONAPI::Serializer do
|
||||
|
||||
it do
|
||||
payload = event_name = nil
|
||||
notification_name = (
|
||||
::JSONAPI::Serializer::Instrumentation::NOTIFICATION_NAMESPACE +
|
||||
'serializable_hash'
|
||||
)
|
||||
notification_name =
|
||||
"#{::JSONAPI::Serializer::Instrumentation::NOTIFICATION_NAMESPACE}serializable_hash"
|
||||
|
||||
ActiveSupport::Notifications.subscribe(
|
||||
notification_name
|
||||
|
Loading…
x
Reference in New Issue
Block a user