Class: FFI::Extractor::PluginList
- Inherits:
-
Object
- Object
- FFI::Extractor::PluginList
- Defined in:
- lib/ffi/extractor/plugin_list.rb
Overview
Represents the list of loaded extractor plugins.
Class Method Summary collapse
-
.default(policy = :default) ⇒ PluginList
Loads the installed extractor plugins.
-
.release(ptr) ⇒ Object
Releases the plugin list.
Instance Method Summary collapse
-
#add(name, options = '', policy = :default) ⇒ PluginList
Loads a plugin and adds it to the list.
-
#initialize(ptr = FFI::Pointer.new(0)) ⇒ PluginList
constructor
Initializes the plugin list.
-
#remove(name) ⇒ PluginList
(also: #delete)
Removes a plugin from the list.
-
#remove_all ⇒ PluginList
(also: #clear)
Removes all plugins from the list.
-
#to_ptr ⇒ FFI::Pointer
Converts the plugin list to a pointer.
Constructor Details
#initialize(ptr = FFI::Pointer.new(0)) ⇒ PluginList
Initializes the plugin list.
36 37 38 |
# File 'lib/ffi/extractor/plugin_list.rb', line 36 def initialize(ptr=FFI::Pointer.new(0)) @ptr = ptr end |
Class Method Details
.default(policy = :default) ⇒ PluginList
Loads the installed extractor plugins.
62 63 64 65 66 67 68 69 70 |
# File 'lib/ffi/extractor/plugin_list.rb', line 62 def self.default(policy=:default) ptr = Extractor.EXTRACTOR_plugin_add_defaults(policy) if ptr.null? raise(LoadError,"no plugins were loaded") end return new(ptr) end |
.release(ptr) ⇒ Object
Releases the plugin list.
46 47 48 |
# File 'lib/ffi/extractor/plugin_list.rb', line 46 def self.release(ptr) Extractor.EXTRACTOR_plugin_remove_all(ptr) end |
Instance Method Details
#add(name, options = '', policy = :default) ⇒ PluginList
Loads a plugin and adds it to the list.
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/ffi/extractor/plugin_list.rb', line 90 def add(name,='',policy=:default) name = name.to_s new_ptr = Extractor.EXTRACTOR_plugin_add(@ptr,name,,policy) if new_ptr == @ptr raise(LoadError,"could not add #{name.dump} to the plugin list") end @ptr = new_ptr return self end |
#remove(name) ⇒ PluginList Also known as: delete
Removes a plugin from the list.
114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/ffi/extractor/plugin_list.rb', line 114 def remove(name) name = name.to_s new_ptr = Extractor.EXTRACTOR_plugin_remove(@ptr,name) if new_ptr == @ptr raise(ArgumentError,"could not remove #{name.dump} from the plugin list") end @ptr = new_ptr return self end |
#remove_all ⇒ PluginList Also known as: clear
Removes all plugins from the list.
134 135 136 137 |
# File 'lib/ffi/extractor/plugin_list.rb', line 134 def remove_all Extractor.EXTRACTOR_plugin_remove_all(@ptr) return self end |
#to_ptr ⇒ FFI::Pointer
Converts the plugin list to a pointer.
147 148 149 |
# File 'lib/ffi/extractor/plugin_list.rb', line 147 def to_ptr @ptr end |