class Chickadee::NumericID

Public Class Methods

new(id) click to toggle source
# File lib/chickadee/vos/numeric_id.rb, line 5
def initialize(id)
  raise(ArgumentError, "invalid id: #{id}") unless id.is_a?(Integer) && id > 0
  @id = id
end

Public Instance Methods

<=>(other) click to toggle source
# File lib/chickadee/vos/numeric_id.rb, line 14
def <=>(other)
  self.to_i <=> other.to_i
end
==(other) click to toggle source
# File lib/chickadee/vos/numeric_id.rb, line 18
def ==(other)
  self.class == other.class && self.hash == other.hash
end
eql?(other) click to toggle source
# File lib/chickadee/vos/numeric_id.rb, line 22
def eql?(other)
  self == other
end
hash() click to toggle source
# File lib/chickadee/vos/numeric_id.rb, line 26
def hash
  @id.hash
end
to_i() click to toggle source
# File lib/chickadee/vos/numeric_id.rb, line 10
def to_i
  @id
end