Module: MorpheusHeroku::Scramblers::Load

Extended by:
Load
Included in:
Load
Defined in:
lib/morpheus-heroku/scramblers/email.rb

Instance Method Summary collapse

Instance Method Details

#dev_domainObject



22
23
24
25
26
27
28
# 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_namespaceObject



30
31
32
33
34
35
36
# 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_emailObject



6
7
8
9
10
11
12
# 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) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
# 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