]> gitweb.michael.orlitzky.com - mailshears.git/blob - lib/common/domain.rb
Allow sorting of User/Domain for testing.
[mailshears.git] / lib / common / domain.rb
1 require 'common/errors'
2
3 class Domain
4
5 @domain = nil
6
7 def initialize(domain)
8 if domain.empty? then
9 msg = "domain cannot be empty"
10 raise InvalidDomainError.new(msg)
11 end
12
13 @domain = domain
14 end
15
16 def to_s()
17 return @domain
18 end
19
20 def ==(other)
21 return self.to_s() == other.to_s()
22 end
23
24 def <=>(other)
25 return self.to_s() <=> other.to_s()
26 end
27 end