]> gitweb.michael.orlitzky.com - mailshears.git/blobdiff - lib/common/domain.rb
Overhaul everything to get consistent error reports.
[mailshears.git] / lib / common / domain.rb
diff --git a/lib/common/domain.rb b/lib/common/domain.rb
new file mode 100644 (file)
index 0000000..5fb345b
--- /dev/null
@@ -0,0 +1,23 @@
+require 'common/errors'
+
+class Domain
+
+  @domain = nil
+
+  def initialize(domain)
+    if domain.empty? then
+      msg = "domain cannot be empty"
+      raise InvalidDomainError.new(msg)
+    end
+
+    @domain = domain
+  end
+
+  def to_s()
+    return @domain
+  end
+
+  def ==(other)
+    return self.to_s() == other.to_s()
+  end
+end