class Seahorse::Client::Plugin
def add_handlers(handlers, config)
-
(void)
-
Parameters:
-
config
(Configuration
) -- -
handlers
(HandlerList
) --
def add_handlers(handlers, config) handlers.copy_from(self.class.handlers) end
def add_options(config)
-
(void)
-
Parameters:
-
config
(Configuration
) --
def add_options(config) self.class.options.each do |option| if option.default_block config.add_option(option.name, &option.default_block) else config.add_option(option.name, option.default) end end end
def after_initialize(client)
-
(void)
-
Parameters:
-
client
(Client::Base
) --
def after_initialize(client) self.class.after_initialize_hooks.each do |block| block.call(client) end end
def after_initialize(&block)
def after_initialize(&block) after_initialize_hooks << block end
def after_initialize_hooks
- Api: - private
def after_initialize_hooks @after_initialize_hooks ||= [] end
def before_initialize(client_class, options)
-
(void)
-
Parameters:
-
options
(Hash
) -- -
client_class
(Class
) --
def before_initialize(client_class, options) self.class.before_initialize_hooks.each do |block| block.call(client_class, options) end end
def before_initialize(&block)
def before_initialize(&block) before_initialize_hooks << block end
def before_initialize_hooks
- Api: - private
def before_initialize_hooks @before_initialize_hooks ||= [] end
def handlers
- Api: - private
def handlers @handlers ||= HandlerList.new end
def literal(string)
- Api: - private
def literal(string) CodeLiteral.new(string) end
def option(name, default = nil, options = {}, &block)
-
(void)
-
Options Hash:
(**options)
-
:docs
(String
) -- -
:doc_type
(String
) -- -
:required
(Boolean
) -- -
:doc_default
(String
) -- -
:default
(Object
) -- Can also be set by passing a block.
Overloads:
-
option(name, options = {}, &block)
def option(name, default = nil, options = {}, &block) # For backwards-compat reasons, the default value can be passed as 2nd # positional argument (before the options hash) or as the `:default` option # in the options hash. if default.is_a? Hash options = default else options[:default] = default end options[:default_block] = block if block_given? self.options << PluginOption.new(name, options) end
def options
- Api: - private
def options @options ||= [] end