Class: FFI::Extractor::MetadataProcessor
- Inherits:
-
Proc
- Object
- Proc
- FFI::Extractor::MetadataProcessor
- Defined in:
- lib/ffi/extractor/metadata_processor.rb
Constant Summary collapse
- PLUGIN_NAMES =
Mapping of plugin paths to names
Hash.new do |plugin_names,plugin| libname = File.basename(plugin,File.extname(plugin)) plugin_names[plugin] = libname.sub('libextractor_','').to_sym end
Class Method Summary collapse
-
.new {|plugin_name, type, format, mime_type, data| ... } ⇒ Proc
Wraps a Metadata Processor callback.
Class Method Details
.new {|plugin_name, type, format, mime_type, data| ... } ⇒ Proc
Wraps a Metadata Processor callback.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ffi/extractor/metadata_processor.rb', line 59 def self.new(&block) super do |cls,plugin,type,format,mime_type,data,size| catch(:return) { value = case format when :c_string, :utf8 then data.get_string(0,size) when :binary then data.get_bytes(0,size) else data end yield PLUGIN_NAMES[plugin], type, format, mime_type, value 0 } end end |