module FFI::Extractor

Constants

VERSION

ffi-extractor version

Public Class Methods

abort!() click to toggle source

Aborts metadata extraction.

# File lib/ffi/extractor/extractor.rb, line 40
def self.abort!
  throw :return, 1
end
extract(data,plugins=Extractor.plugins,&block) click to toggle source

Extracts metadata.

@param [String] data

The data to extract from.

@param [PluginList] plugins

The extraction plugins to use.

@yield [plugin_name, type, format, mime_type, data]

The given block will be passed the extracted metadata.

@yieldparam [Symbol] plugin_name

The name of the plugin.

@yieldparam [Symbol] type

The type of metadata.

@yieldparam [:unknown, :utf8, :binary, :c_string] format

The format of the metadata.

@yieldparam [String] mime_type

The MIME-type of the data.

@yieldparam [String] data

The extracted metadata.
# File lib/ffi/extractor/extractor.rb, line 71
def self.extract(data,plugins=Extractor.plugins,&block)
  processor = MetadataProcessor.new(&block)

  Extractor.EXTRACTOR_extract(plugins,nil,data,data.length,processor,nil)
end
extract_from(path,plugins=Extractor.plugins,&block) click to toggle source

Extracts metadata from a file.

@param [String] path

The path to the file.

@param [PluginList] plugins

The extraction plugins to use.

@yield [plugin_name, type, format, mime_type, data]

The given block will be passed the extracted metadata.

@yieldparam [Symbol] plugin_name

The name of the plugin.

@yieldparam [Symbol] type

The type of metadata.

@yieldparam [:unknown, :utf8, :binary, :c_string] format

The format of the metadata.

@yieldparam [String] mime_type

The MIME-type of the data.

@yieldparam [String] data

The extracted metadata.
# File lib/ffi/extractor/extractor.rb, line 104
def self.extract_from(path,plugins=Extractor.plugins,&block)
  processor = MetadataProcessor.new(&block)

  Extractor.EXTRACTOR_extract(plugins,path,nil,0,processor,nil)
end
plugins() click to toggle source

The default list of plugins.

@return [PluginList]

The plugin list.
# File lib/ffi/extractor/extractor.rb, line 33
def self.plugins
  @plugins ||= PluginList.default
end