Fix Style/ClassEqualityComparison
cop (#30058)
This commit is contained in:
parent
72484a194f
commit
348ccf206e
3 changed files with 2 additions and 10 deletions
|
@ -31,14 +31,6 @@ Rails/OutputSafety:
|
||||||
Exclude:
|
Exclude:
|
||||||
- 'config/initializers/simple_form.rb'
|
- 'config/initializers/simple_form.rb'
|
||||||
|
|
||||||
# This cop supports unsafe autocorrection (--autocorrect-all).
|
|
||||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
|
||||||
# AllowedMethods: ==, equal?, eql?
|
|
||||||
Style/ClassEqualityComparison:
|
|
||||||
Exclude:
|
|
||||||
- 'app/helpers/jsonld_helper.rb'
|
|
||||||
- 'app/serializers/activitypub/outbox_serializer.rb'
|
|
||||||
|
|
||||||
# This cop supports safe autocorrection (--autocorrect).
|
# This cop supports safe autocorrection (--autocorrect).
|
||||||
# Configuration parameters: AllowedVars.
|
# Configuration parameters: AllowedVars.
|
||||||
Style/FetchEnvVar:
|
Style/FetchEnvVar:
|
||||||
|
|
|
@ -141,7 +141,7 @@ module JsonLdHelper
|
||||||
def safe_for_forwarding?(original, compacted)
|
def safe_for_forwarding?(original, compacted)
|
||||||
original.without('@context', 'signature').all? do |key, value|
|
original.without('@context', 'signature').all? do |key, value|
|
||||||
compacted_value = compacted[key]
|
compacted_value = compacted[key]
|
||||||
return false unless value.class == compacted_value.class
|
return false unless value.instance_of?(compacted_value.class)
|
||||||
|
|
||||||
if value.is_a?(Hash)
|
if value.is_a?(Hash)
|
||||||
safe_for_forwarding?(value, compacted_value)
|
safe_for_forwarding?(value, compacted_value)
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
class ActivityPub::OutboxSerializer < ActivityPub::CollectionSerializer
|
class ActivityPub::OutboxSerializer < ActivityPub::CollectionSerializer
|
||||||
def self.serializer_for(model, options)
|
def self.serializer_for(model, options)
|
||||||
if model.class.name == 'ActivityPub::ActivityPresenter'
|
if model.instance_of?(::ActivityPub::ActivityPresenter)
|
||||||
ActivityPub::ActivitySerializer
|
ActivityPub::ActivitySerializer
|
||||||
else
|
else
|
||||||
super
|
super
|
||||||
|
|
Loading…
Reference in a new issue