class Hermeneutics::ContentType
Public Class Methods
new( str) → cts
click to toggle source
Create a ContentType
object either out of a string from an E-Mail header field or from a value and a hash.
c = ContentType.parse "text/html; boundary=0123456" c = ContentType.new "text/html", boundary: "0123456"
Calls superclass method
Hermeneutics::Contents::new
# File lib/hermeneutics/contents.rb, line 289 def initialize line, sf = nil line = line.join "/" if Array === line super end
Public Instance Methods
fulltype → str
click to toggle source
Find caption value of Content-Type style header field.
c = ContentType.new "text/html; boundary=0123456" c.fulltype #=> "text/html" c.type #=> "text" c.subtype #=> "html"
# File lib/hermeneutics/contents.rb, line 316 def fulltype ; caption ; end
parse_mime(input)
click to toggle source
# File lib/hermeneutics/contents.rb, line 332 def parse_mime input m = Mime.find @caption m and m.parse input, **@hash end
split_type → str
click to toggle source
Find caption value of Content-Type style header field as an array
c = ContentType.new "text/html; boundary=0123456" c.split_type #=> [ "text", "html"] c.type #=> "text" c.subtype #=> "html"
# File lib/hermeneutics/contents.rb, line 304 def split_type ; @split ||= (@caption.split "/", 2) ; end
subtype → str
click to toggle source
See fulltype
or split_type
.
# File lib/hermeneutics/contents.rb, line 330 def subtype ; split_type.last ; end
type → str
click to toggle source
See fulltype
or split_type
.
# File lib/hermeneutics/contents.rb, line 323 def type ; split_type.first ; end