Skip to content

Commit e4dce97

Browse files
RogersRogers
authored andcommitted
Replace unless with a guard clause
1 parent 2f05515 commit e4dce97

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/zendesk_api/resource.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ def ==(other)
137137

138138
return other.id && (other.id == id) if other.is_a?(Data)
139139

140-
unless other.is_a?(Integer)
141-
return warn "Trying to compare #{other.class} to a Resource
142-
from #{caller.first}"
143-
end
140+
return id == other if other.is_a?(Integer)
144141

145-
id == other
142+
warn "Trying to compare #{other.class} to a Resource
143+
from #{caller.first}"
146144
end
147145
alias :eql :==
148146

0 commit comments

Comments
 (0)