Class: CouchShell::Plugin

Inherits:
Object
  • Object
show all
Includes:
PluginUtils
Defined in:
lib/couch-shell/plugin.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from PluginUtils

#continue?, #dbname!, #editfile!, #edittext!, #ensure_at_database, #request!

Constructor Details

#initialize(shell) ⇒ Plugin

Do not override this method, override plugin_initialization if you need custom initialization logic.



220
221
222
# File 'lib/couch-shell/plugin.rb', line 220

def initialize(shell)
  @_couch_shell_shell = shell
end

Class Method Details

.inherited(klass) ⇒ Object



213
214
215
216
# File 'lib/couch-shell/plugin.rb', line 213

def self.inherited(klass)
  klass.extend PluginClass
  PluginInfo.register(klass)
end

Instance Method Details

#plugin_infoObject



228
229
230
# File 'lib/couch-shell/plugin.rb', line 228

def plugin_info
  self.class.plugin_info
end

#plugin_initializationObject

Called by the shell after it instantiates the plugin. The shell attribute will be already set.

Override this method if your plugin needs custom initialization logic or to alter the shell behaviour beyond adding variables and commands. The default implementation does nothing.



242
243
# File 'lib/couch-shell/plugin.rb', line 242

def plugin_initialization
end

#plugin_nameObject



232
233
234
# File 'lib/couch-shell/plugin.rb', line 232

def plugin_name
  plugin_info.plugin_name
end

#shellObject



224
225
226
# File 'lib/couch-shell/plugin.rb', line 224

def shell
  @_couch_shell_shell
end

#variables_objectObject



245
246
247
# File 'lib/couch-shell/plugin.rb', line 245

def variables_object
  PluginVariablesObject.new(self)
end