Class: TMail::ContentTypeHeader

Inherits:
StructuredHeader show all
Defined in:
lib/gems/tmail-1.2.3.1/lib/tmail/header.rb

Constant Summary collapse

PARSE_TYPE =
:CTYPE

Constants inherited from HeaderField

HeaderField::FNAME_TO_CLASS

Constants included from TextUtils

TextUtils::ATOM_UNSAFE, TextUtils::CONTROL_CHAR, TextUtils::MESSAGE_ID, TextUtils::MIME_ENCODED, TextUtils::MONTH, TextUtils::NKF_FLAGS, TextUtils::PHRASE_UNSAFE, TextUtils::RFC2231_ENCODED, TextUtils::TOKEN_UNSAFE, TextUtils::WDAY, TextUtils::ZONESTR_TABLE

Instance Method Summary collapse

Methods inherited from StructuredHeader

#comments

Methods inherited from HeaderField

#accept, #body, #body=, #empty?, #illegal?, #initialize, #inspect, internal_new, new, new_from_port, newobj

Methods included from StrategyInterface

#accept_strategy, create_dest, #decoded, #encoded

Methods included from TextUtils

#atom_safe?, #decode_RFC2231, #decode_params, #join_domain, #message_id?, #mime_encoded?, #quote_atom, #quote_boundary, #quote_phrase, #quote_token, #time2str, #timezone_string_to_unixtime, #to_kcode, #token_safe?, #unquote

Constructor Details

This class inherits a constructor from TMail::HeaderField

Instance Method Details

#[](key) ⇒ Object



786
787
788
789
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 786

def []( key )
  ensure_parsed
  @params and unquote(@params[key])
end

#[]=(key, val) ⇒ Object



791
792
793
794
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 791

def []=( key, val )
  ensure_parsed
  (@params ||= {})[key] = val
end

#content_typeObject



771
772
773
774
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 771

def content_type
  ensure_parsed
  @sub ? sprintf('%s/%s', @main, @sub) : @main
end

#main_typeObject



751
752
753
754
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 751

def main_type
  ensure_parsed
  @main
end

#main_type=(arg) ⇒ Object



756
757
758
759
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 756

def main_type=( arg )
  ensure_parsed
  @main = arg.downcase
end

#paramsObject



776
777
778
779
780
781
782
783
784
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 776

def params
  ensure_parsed
  unless @params.blank?
    @params.each do |k, v|
      @params[k] = unquote(v)
    end
  end
  @params
end

#sub_typeObject



761
762
763
764
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 761

def sub_type
  ensure_parsed
  @sub
end

#sub_type=(arg) ⇒ Object



766
767
768
769
# File 'lib/gems/tmail-1.2.3.1/lib/tmail/header.rb', line 766

def sub_type=( arg )
  ensure_parsed
  @sub = arg.downcase
end