Module: Centro::Canonical::ClassMethods

Defined in:
lib/canonical-email.rb

Instance Method Summary collapse

Instance Method Details

#add_canonical_override(pattern, override) ⇒ Object



99
100
101
# File 'lib/canonical-email.rb', line 99

def add_canonical_override(pattern, override)
  overrides << [ pattern, override ]
end

#add_canonical_passthrough(pattern) ⇒ Object



95
96
97
# File 'lib/canonical-email.rb', line 95

def add_canonical_passthrough(pattern)
  overrides << [ pattern, :passthrough ]
end

#canonical_destination(email) ⇒ Object



103
104
105
106
107
108
# File 'lib/canonical-email.rb', line 103

def canonical_destination(email)
  overrides.each do |pattern, replace|
    return (:passthrough == replace ? email : replace) if email =~ pattern
  end
  email
end

#clear_canonicalObject



91
92
93
# File 'lib/canonical-email.rb', line 91

def clear_canonical
  self.overrides = nil
end