Sha256: d068e3e66e6552654bd23f9c7686ada2e9d8b5f8fa46c1a282c196543d1ea7e2
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
module MailSafe class InvalidConfigSettingError < StandardError; end class Config cattr_accessor :internal_address_definition def self.is_internal_address?(address) case internal_address_definition when Regexp then !!(address =~ internal_address_definition) when Proc then internal_address_definition.call(address) else return address.downcase == developer_email_address.downcase if developer_email_address raise InvalidConfigSettingError.new("Ensure internal_address_definition is a Regexp or a Proc. It was: #{internal_address_definition.class.to_s}") end end cattr_accessor :replacement_address def self.get_replacement_address(original_address) case replacement_address when String then replacement_address when Proc then replacement_address.call(original_address) else return developer_email_address if developer_email_address raise InvalidConfigSettingError.new("Ensure replacement_address is a String or a Proc. It was: #{replacement_address.class.to_s}. Or at least set your user email in git.") end end def self.developer_email_address unless defined?(@@developer_email_address) @@developer_email_address = begin `git config user.email`.strip rescue nil end @@developer_email_address = nil if @@developer_email_address.blank? end @@developer_email_address end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mail_safe-0.3.4 | lib/mail_safe/config.rb |