From b7e806abbe49b58efc952a5ae7d5a219719a1769 Mon Sep 17 00:00:00 2001 From: Kenichi Kamiya Date: Sat, 8 May 2021 03:48:24 +0900 Subject: [PATCH] Simplify `ULID#===` Might be changed in #57 and https://github.com/ulid/spec/pull/57 But this is enough for now --- lib/ulid.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/ulid.rb b/lib/ulid.rb index 0fa60772..60ad42b8 100644 --- a/lib/ulid.rb +++ b/lib/ulid.rb @@ -353,13 +353,9 @@ def eql?(other) def ===(other) case other when ULID - self == other + to_i == other.to_i when String - begin - self == self.class.parse(other) - rescue Exception - false - end + to_s == other.upcase else false end