Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/magic/core/string.rb

Instance Method Summary collapse

Instance Method Details

#magic(flags = Magic::NONE) ⇒ Object

call-seq:

string.magic -> string, array or nil

Returns

Example:

See also: String#mime and String#type



39
40
41
42
# File 'lib/magic/core/string.rb', line 39

def magic(flags = Magic::NONE)
  Magic.open(flags) {|mgc| mgc.buffer(self) }
rescue Magic::Error
end

#mimeObject

call-seq:

string.mime -> string, array or nil

Returns

Example:

See also: String#magic and String#type



54
55
56
# File 'lib/magic/core/string.rb', line 54

def mime
  magic(Magic::MIME)
end

#typeObject

call-seq:

string.type -> string, array or nil

Returns

Example:

See also: String#magic and String#mime



68
69
70
# File 'lib/magic/core/string.rb', line 68

def type
  magic(Magic::MIME_TYPE)
end