From 62fdcc8cf744d29788cfcd050b4b567de1eeea2c Mon Sep 17 00:00:00 2001 From: lgebhardt Date: Wed, 19 May 2021 16:16:34 -0400 Subject: [PATCH] Ensure eql? comparison object is the type expected --- lib/jsonapi/path_segment.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jsonapi/path_segment.rb b/lib/jsonapi/path_segment.rb index aa2d78050..c0bac6536 100644 --- a/lib/jsonapi/path_segment.rb +++ b/lib/jsonapi/path_segment.rb @@ -30,7 +30,7 @@ def initialize(relationship:, resource_klass: nil) end def eql?(other) - relationship == other.relationship && resource_klass == other.resource_klass + other.is_a?(JSONAPI::PathSegment::Relationship) && relationship == other.relationship && resource_klass == other.resource_klass end def hash @@ -59,7 +59,7 @@ def initialize(resource_klass:, field_name:) end def eql?(other) - field_name == other.field_name && resource_klass == other.resource_klass + other.is_a?(JSONAPI::PathSegment::Field) && field_name == other.field_name && resource_klass == other.resource_klass end def delegated_field_name