lib/gman/locality.rb in gman-6.0.1 vs lib/gman/locality.rb in gman-7.0.0

- old
+ new

@@ -1,6 +1,18 @@ class Gman + # Second level .us domains for states and locality + # See http://en.wikipedia.org/wiki/.us + # + # Examples: + # * foo.state.il.us + # * ci.foo.il.us + # + # Not: + # * state.foo.il.us + # * foo.ci.il.us + # * k12.il.us + # * ci.foo.zx.us class Locality AFFINITY_NAMESPACES = %w(state dst cog).freeze STATES = %w( ak al ar az ca co ct dc de fl ga hi ia id il in ks ky @@ -18,23 +30,11 @@ (#{Regexp.union(AFFINITY_NAMESPACES)}) | (#{Regexp.union(LOCALITY_DOMAINS)})\.[a-z-]+ )\.(#{Regexp.union(STATES)})\.us /x - end - # Second level .us domains for states and locality - # See http://en.wikipedia.org/wiki/.us - # - # Examples: - # * foo.state.il.us - # * ci.foo.il.us - # - # Not: - # * state.foo.il.us - # * foo.ci.il.us - # * k12.il.us - # * ci.foo.zx.us - def locality? - !domain.to_s.match(Locality::REGEX).nil? + def self.valid?(domain) + !domain.to_s.match(Locality::REGEX).nil? + end end end