class Seahorse::Client::Plugin
Public Class Methods
after_initialize(&block)
click to toggle source
# File lib/seahorse/client/plugin.rb, line 53 def after_initialize(&block) after_initialize_hooks << block end
after_initialize_hooks()
click to toggle source
@api private
# File lib/seahorse/client/plugin.rb, line 73 def after_initialize_hooks @after_initialize_hooks ||= [] end
before_initialize(&block)
click to toggle source
# File lib/seahorse/client/plugin.rb, line 49 def before_initialize(&block) before_initialize_hooks << block end
before_initialize_hooks()
click to toggle source
@api private
# File lib/seahorse/client/plugin.rb, line 68 def before_initialize_hooks @before_initialize_hooks ||= [] end
handlers()
click to toggle source
@api private
# File lib/seahorse/client/plugin.rb, line 63 def handlers @handlers ||= HandlerList.new end
option(name, default = nil, &block)
click to toggle source
# File lib/seahorse/client/plugin.rb, line 41 def option(name, default = nil, &block) if block_given? options << [[name], Proc.new] else options << [[name, default]] end end
options()
click to toggle source
@api private
# File lib/seahorse/client/plugin.rb, line 58 def options @options ||= [] end
Public Instance Methods
add_handlers(handlers, config)
click to toggle source
@param [HandlerList] handlers @param [Configuration] config @return [void]
# File lib/seahorse/client/plugin.rb, line 18 def add_handlers(handlers, config) handlers.copy_from(self.class.handlers) end
add_options(config)
click to toggle source
@param [Configuration] config @return [void]
# File lib/seahorse/client/plugin.rb, line 9 def add_options(config) self.class.options.each do |args, block| config.add_option(*args, &block) end end
after_initialize(client)
click to toggle source
@param [Client::Base] client @return [void]
# File lib/seahorse/client/plugin.rb, line 33 def after_initialize(client) self.class.after_initialize_hooks.each do |block| block.call(client) end end
before_initialize(client_class, options)
click to toggle source
@param [Class<Client::Base>] client_class @param [Hash] options @return [void]
# File lib/seahorse/client/plugin.rb, line 25 def before_initialize(client_class, options) self.class.before_initialize_hooks.each do |block| block.call(client_class, options) end end