Sha256: 1b92cbffa5d57c31e888641c83b5d389d5fce9bcccce6a8dc54882f9ccf89ccd
Contents?: true
Size: 804 Bytes
Versions: 42
Compression:
Stored size: 804 Bytes
Contents
require "plek" class FactCheckAddress DOMAIN = "alphagov.co.uk" def for_edition(edition) "#{prefix}#{edition.id}@#{DOMAIN}" end def valid_address?(address) regexp.match(address) end def edition_id_from_address(address) match = valid_address?(address) match && match[1] end private def regexp /#{Regexp.escape(prefix)}(.+?)@#{DOMAIN}/ end def prefix "factcheck+#{environment}-" end # Fact check email addresses are environment dependent. This is # a bad thing, but changing it would be very disruptive. Since # Plek no longer gives us access to the environment we have to rely # on the fact that the environment is included in the public domain # name for an app. def environment Plek.current.find('publisher').split('.')[1] end end
Version data entries
42 entries across 42 versions & 1 rubygems