Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
Compare with nil when supplied argument is nil
Browse files Browse the repository at this point in the history
- Avoid no method 'name' for nil error.
- The default spaceship operator also will return a nil instead of
  -1,0,1 if the objects provided are not comparable.
- coincidentally fixes a compatability issue seen with ruby 2.3.1
  • Loading branch information
unimatrixZxero committed Jul 12, 2016
1 parent 605e0fd commit 3dc3bf1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fakes3/s3_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def eql?(object)

# Sort by the object's name
def <=>(object)
@name <=> object.name
@name <=> (object && object.name)
end
end
end

0 comments on commit 3dc3bf1

Please sign in to comment.