main_type()
click to toggle source
# File lib/mail/fields/content_type_field.rb, line 50 def main_type @main_type ||= element.main_type end
StructuredField
# File lib/mail/fields/content_type_field.rb, line 80 def ContentTypeField.generate_boundary "--==_mimepart_#{Mail.random_tag}" end
# File lib/mail/fields/content_type_field.rb, line 10 def initialize(*args) if args.last.class == Array @main_type = args.last[0] @sub_type = args.last[1] @parameters = ParameterHash.new.merge!(args.last.last) super(CAPITALIZED_FIELD, args.last) else @main_type = nil @sub_type = nil @parameters = nil super(CAPITALIZED_FIELD, strip_field(FIELD_NAME, args.last)) end self.parse self end
# File lib/mail/fields/content_type_field.rb, line 42 def attempt_to_clean # Sanitize the value, handle special cases @element ||= Mail::ContentTypeElement.new(sanatize(value)) rescue # All else fails, just get the mime type @element ||= Mail::ContentTypeElement.new(get_mime_type(value)) end
# File lib/mail/fields/content_type_field.rb, line 113 def decoded value end
# File lib/mail/fields/content_type_field.rb, line 62 def default decoded end
# File lib/mail/fields/content_type_field.rb, line 34 def element begin @element ||= Mail::ContentTypeElement.new(value) rescue attempt_to_clean end end
TODO: Fix this up
# File lib/mail/fields/content_type_field.rb, line 109 def encoded "#{CAPITALIZED_FIELD}: #{content_type};\r\n\t#{parameters.encoded};\r\n" end
# File lib/mail/fields/content_type_field.rb, line 96 def filename case when parameters['filename'] @filename = parameters['filename'] when parameters['name'] @filename = parameters['name'] else @filename = nil end @filename end
# File lib/mail/fields/content_type_field.rb, line 50 def main_type @main_type ||= element.main_type end
# File lib/mail/fields/content_type_field.rb, line 68 def parameters unless @parameters @parameters = ParameterHash.new element.parameters.each { |p| @parameters.merge!(p) } end @parameters end
# File lib/mail/fields/content_type_field.rb, line 26 def parse(val = value) unless val.blank? self.value = val @element = nil element end end
# File lib/mail/fields/content_type_field.rb, line 58 def string "#{main_type}/#{sub_type}" end
# File lib/mail/fields/content_type_field.rb, line 92 def stringify(params) params.map { |k,v| "#{k}=#{Encodings.param_encode(v)}" }.join("; ") end
Generated with the Darkfish Rdoc Generator 2.