Class: MList::Util::QuotingSanitizer

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

Instance Method Summary collapse

Constructor Details

#initialize(method, bracket_urls) ⇒ QuotingSanitizer

Returns a new instance of QuotingSanitizer.



7
8
9
# File 'lib/mlist/util/header_sanitizer.rb', line 7

def initialize(method, bracket_urls)
  @method, @bracket_urls = method, bracket_urls
end

Instance Method Details

#bracket_urls(values) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/mlist/util/header_sanitizer.rb', line 11

def bracket_urls(values)
  values.map do |value|
    if value.include?('<') && value.include?('>')
      value
    else
      "<#{value}>"
    end
  end
end

#call(charset, *values) ⇒ Object



21
22
23
24
# File 'lib/mlist/util/header_sanitizer.rb', line 21

def call(charset, *values)
  values = bracket_urls(values.flatten) if @bracket_urls
  send(@method, charset, *values)
end