module MorpheusHeroku::Scramblers::Load

Public Instance Methods

dev_domain() click to toggle source
# File lib/morpheus-heroku/scramblers/email.rb, line 22
def dev_domain
  @dev_domain ||= if MorpheusHeroku.configuration.dev_email
    "@" + MorpheusHeroku.configuration.dev_email.match(/(.*)@(.*)/)[2]
  else
    ""
  end
end
dev_namespace() click to toggle source
# File lib/morpheus-heroku/scramblers/email.rb, line 30
def dev_namespace
  @dev_namespace ||= if MorpheusHeroku.configuration.dev_email
    MorpheusHeroku.configuration.dev_email.match(/(.*)@(.*)/)[1]
  else
    ""
  end
end
scrambled_email() click to toggle source
# File lib/morpheus-heroku/scramblers/email.rb, line 6
def scrambled_email
  if dev_namespace.present? && dev_domain.present?
    "#{dev_namespace}+#{random_string}@#{dev_domain}"
  else
    "dev+#{random_string}@example.com"
  end
end
should_scramble_email?(email) click to toggle source
# File lib/morpheus-heroku/scramblers/email.rb, line 14
def should_scramble_email?(email)
  if dev_domain.present?
    email.include?(dev_domain)
  else
    false
  end
end

Private Instance Methods

random_string() click to toggle source
# File lib/morpheus-heroku/scramblers/email.rb, line 40
def random_string
  SecureRandom.hex.first(6)
end