class TMail::ContentTypeHeader

Constants

PARSE_TYPE

Public Instance Methods

[]( key ) click to toggle source
# File lib/tmail/header.rb, line 788
def []( key )
  ensure_parsed
  @params and unquote(@params[key])
end
[]=( key, val ) click to toggle source
# File lib/tmail/header.rb, line 793
def []=( key, val )
  ensure_parsed
  (@params ||= {})[key] = val
end
content_type() click to toggle source
# File lib/tmail/header.rb, line 773
def content_type
  ensure_parsed
  @sub ? sprintf('%s/%s', @main, @sub) : @main
end
main_type() click to toggle source
# File lib/tmail/header.rb, line 753
def main_type
  ensure_parsed
  @main
end
main_type=( arg ) click to toggle source
# File lib/tmail/header.rb, line 758
def main_type=( arg )
  ensure_parsed
  @main = arg.downcase
end
params() click to toggle source
# File lib/tmail/header.rb, line 778
def params
  ensure_parsed
  unless @params.blank?
    @params.each do |k, v|
      @params[k] = unquote(v)
    end
  end
  @params
end
sub_type() click to toggle source
# File lib/tmail/header.rb, line 763
def sub_type
  ensure_parsed
  @sub
end
sub_type=( arg ) click to toggle source
# File lib/tmail/header.rb, line 768
def sub_type=( arg )
  ensure_parsed
  @sub = arg.downcase
end

Private Instance Methods

do_accept( strategy ) click to toggle source
# File lib/tmail/header.rb, line 812
def do_accept( strategy )
  if @sub
    strategy.meta sprintf('%s/%s', @main, @sub)
  else
    strategy.meta @main
  end
  @params.each do |k,v|
    if v
      strategy.meta ';'
      strategy.space
      strategy.kv_pair k, unquote(v)
    end
  end
end
init() click to toggle source
# File lib/tmail/header.rb, line 800
def init
  @main = @sub = @params = nil
end
isempty?() click to toggle source
# File lib/tmail/header.rb, line 808
def isempty?
  not (@main or @sub)
end
set( args ) click to toggle source
# File lib/tmail/header.rb, line 804
def set( args )
  @main, @sub, @params = *args
end