Skip to content

Commit

Permalink
Ensure eql? comparison object is the type expected (#1368)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgebhardt authored May 19, 2021
1 parent 49d213d commit 2c853dd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/jsonapi/path_segment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2c853dd

Please sign in to comment.