Class: MList::Util::HeaderSanitizerHash

Inherits:
Object
  • Object
show all
Defined in:
lib/mlist/util/header_sanitizer.rb

Instance Method Summary collapse

Constructor Details

#initializeHeaderSanitizerHash

Returns a new instance of HeaderSanitizerHash.



28
29
30
31
# File 'lib/mlist/util/header_sanitizer.rb', line 28

def initialize
  @hash = Hash.new
  initialize_default_sanitizers
end

Instance Method Details

#[](key) ⇒ Object



57
58
59
# File 'lib/mlist/util/header_sanitizer.rb', line 57

def [](key)
  @hash[key.downcase] ||= lambda { |charset, value| value }
end

#[]=(key, value) ⇒ Object



61
62
63
# File 'lib/mlist/util/header_sanitizer.rb', line 61

def []=(key, value)
  @hash[key.downcase] = value
end

#initialize_default_sanitizersObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/mlist/util/header_sanitizer.rb', line 33

def initialize_default_sanitizers
  self['message-id'] = quoter(:quote_address_if_necessary)
  
  self['to']       = quoter(:quote_any_address_if_necessary)
  self['cc']       = quoter(:quote_any_address_if_necessary)
  self['bcc']      = quoter(:quote_any_address_if_necessary)
  self['from']     = quoter(:quote_any_address_if_necessary)
  self['reply-to'] = quoter(:quote_any_address_if_necessary)
  self['subject']  = quoter(:quote_any_if_necessary)
  
  self['sender']      = quoter(:quote_address_if_necessary)
  self['errors-to']   = quoter(:quote_address_if_necessary)
  self['in-reply-to'] = quoter(:quote_any_address_if_necessary)
  self['x-mailer']    = quoter(:quote_if_necessary, false)
  
  self['list-id']          = quoter(:quote_address_if_necessary)
  self['list-help']        = quoter(:quote_address_if_necessary)
  self['list-subscribe']   = quoter(:quote_address_if_necessary)
  self['list-unsubscribe'] = quoter(:quote_address_if_necessary)
  self['list-post']        = quoter(:quote_address_if_necessary)
  self['list-owner']       = quoter(:quote_address_if_necessary)
  self['list-archive']     = quoter(:quote_address_if_necessary)
end

#quoter(method, bracket_urls = true) ⇒ Object



65
66
67
# File 'lib/mlist/util/header_sanitizer.rb', line 65

def quoter(method, bracket_urls = true)
  QuotingSanitizer.new(method, bracket_urls)
end