Module: ULID::Compare

Included in:
Identifier
Defined in:
lib/ulid/compare.rb

Instance Method Summary collapse

Instance Method Details

#<(other) ⇒ Object



14
15
16
17
18
19
20
21
22
23
# File 'lib/ulid/compare.rb', line 14

def <(other)
  case other
  when self.class
    self.ulid < other.ulid
  when Time
    self.time < other
  when String
    self.ulid < other
  end
end

#<=>(other) ⇒ Object



25
26
27
28
29
30
31
32
33
34
# File 'lib/ulid/compare.rb', line 25

def <=>(other)
  case other
  when self.class
    self.ulid <=> other.ulid
  when Time
    self.time <=> other
  when String
    self.ulid <=> other
  end
end

#>(other) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/ulid/compare.rb', line 3

def >(other)
  case other
  when self.class
    self.ulid > other.ulid
  when Time
    self.time > other
  when String
    self.ulid > other
  end
end