Class: Seahorse::Client::PluginList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
gems/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)


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

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:



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

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

#each(&block) ⇒ Enumerator

Enumerates the plugins.

Returns:

  • (Enumerator)


59
60
61
62
63
# File 'gems/aws-sdk-core/lib/seahorse/client/plugin_list.rb', line 59

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:



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

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:



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

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