Class: Weechat::Plugin
Overview
Gettable properties
- filename
-
Filename of the plugin
- handle
-
?
- name
-
Name of the plugin
- description
-
Description of the plugin
- author
-
Author of the plugin
- version
-
Version of the plugin
- license
-
Licence of the plugin
- charset
-
?
- debug?
-
?
Instance Attribute Summary
Attributes included from Pointer
Class Method Summary collapse
- .find_by_name(name) ⇒ Object (also: find)
-
.load(name) ⇒ void
Loads a plugin.
- .plugins ⇒ Object (also: all)
-
.reload_all ⇒ Array<Plugin>
Reloads all plugins.
Instance Method Summary collapse
- #name ⇒ Object
-
#reload(force = false) ⇒ Boolean
Reload the plugin.
-
#scripts ⇒ Array<Script>
Returns an array of all scripts loaded by this plugin.
-
#unload(force = false) ⇒ Boolean
Unloads the plugin.
Methods included from Weechat::Properties::ClassMethods
#apply_transformation, #init_properties, #known_integer_properties, #known_properties, #known_string_properties, #mappings, #rtransformations, #settable_properties, #transformations, #type
Methods included from Pointer
#==, #hash, #initialize, #inspect, #to_s
Class Method Details
.find_by_name(name) ⇒ Object Also known as: find
29 30 31 32 33 34 |
# File 'lib/weechat/plugin.rb', line 29 def find_by_name(name) if name.nil? or name.empty? or name == "core" return Plugin.new("") end plugins.find {|plugin| plugin.name == name} end |
.load(name) ⇒ void
This method returns an undefined value.
Loads a plugin.
49 50 51 |
# File 'lib/weechat/plugin.rb', line 49 def load(name) Weechat.exec("/plugin load #{name}") end |
Instance Method Details
#name ⇒ Object
64 65 66 |
# File 'lib/weechat/plugin.rb', line 64 def name Weechat.plugin_get_name(@ptr) end |
#reload(force = false) ⇒ Boolean
Reload the plugin.
87 88 89 90 91 92 93 |
# File 'lib/weechat/plugin.rb', line 87 def reload(force = false) if name == "ruby" and !force Weechat.puts "Won't reload the ruby plugin unless you force it." else Weechat.exec("/plugin reload #{name}") end end |
#scripts ⇒ Array<Script>
Returns an array of all scripts loaded by this plugin.
98 99 100 101 102 103 104 |
# File 'lib/weechat/plugin.rb', line 98 def scripts scripts = [] Infolist.parse("#{name}_script").each do |script| scripts << Script.new(script[:pointer], self) end scripts end |
#unload(force = false) ⇒ Boolean
Unloads the plugin.
73 74 75 76 77 78 79 80 81 |
# File 'lib/weechat/plugin.rb', line 73 def unload(force = false) if name == "ruby" and !force Weechat.puts "Won't unload the ruby plugin unless you force it." false else Weechat.exec("/plugin unload #{name}") true end end |