You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Seahorse::Client::PluginList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
aws-sdk-core/lib/seahorse/client/plugin_list.rb

Instance Method Summary collapse

Constructor Details

#initialize(plugins = [], options = {}) ⇒ PluginList

Returns a new instance of PluginList.

Parameters:

  • plugins (Array, Set) (defaults to: [])
  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :mutex (Mutex)


12
13
14
15
16
17
18
19
20
# File 'aws-sdk-core/lib/seahorse/client/plugin_list.rb', line 12

def initialize(plugins = [], options = {})
  @mutex = options[:mutex] || Mutex.new
  @plugins = Set.new
  if plugins.is_a?(PluginList)
    plugins.send(:each_plugin) { |plugin| _add(plugin) }
  else
    plugins.each { |plugin| _add(plugin) }
  end
end

Instance Method Details

#add(plugin) ⇒ void

This method returns an undefined value.

Adds and returns the plugin.

Parameters:



25
26
27
28
29
30
# File 'aws-sdk-core/lib/seahorse/client/plugin_list.rb', line 25

def add(plugin)
  @mutex.synchronize do
    _add(plugin)
  end
  nil
end

#each(&block) ⇒ Enumerator

Enumerates the plugins.

Returns:

  • (Enumerator)


57
58
59
60
61
# File 'aws-sdk-core/lib/seahorse/client/plugin_list.rb', line 57

def each(&block)
  each_plugin do |plugin_wrapper|
    yield(plugin_wrapper.plugin)
  end
end

#remove(plugin) ⇒ void

This method returns an undefined value.

Removes and returns the plugin.

Parameters:



35
36
37
38
39
40
# File 'aws-sdk-core/lib/seahorse/client/plugin_list.rb', line 35

def remove(plugin)
  @mutex.synchronize do
    @plugins.delete(PluginWrapper.new(plugin))
  end
  nil
end

#set(plugins) ⇒ void

This method returns an undefined value.

Replaces the existing list of plugins.

Parameters:



45
46
47
48
49
50
51
52
53
# File 'aws-sdk-core/lib/seahorse/client/plugin_list.rb', line 45

def set(plugins)
  @mutex.synchronize do
    @plugins.clear
    plugins.each do |plugin|
      _add(plugin)
    end
  end
  nil
end