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 or array

See also: String#mime and String#type



10
11
12
# File 'lib/magic/core/string.rb', line 10

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

#mimeObject

call-seq:

string.mime -> string or array

See also: String#magic and String#type



20
21
22
# File 'lib/magic/core/string.rb', line 20

def mime
  magic(Magic::MIME)
end

#typeObject

call-seq:

string.type -> string or array

See also: String#magic and String#mime



30
31
32
# File 'lib/magic/core/string.rb', line 30

def type
  magic(Magic::MIME_TYPE)
end