Class: Qonfig::CommandSet Private

Inherits:
Object
  • Object
show all
Defined in:
lib/qonfig/command_set.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 0.1.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCommandSet

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of CommandSet.

Since:

  • 0.1.0



15
16
17
18
# File 'lib/qonfig/command_set.rb', line 15

def initialize
  @commands = []
  @access_lock = Mutex.new
end

Instance Attribute Details

#commandsArray<Qonfig::Commands::Base> (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 0.1.0



11
12
13
# File 'lib/qonfig/command_set.rb', line 11

def commands
  @commands
end

Instance Method Details

#add_command(command) ⇒ void Also known as: <<

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

Since:

  • 0.1.0



25
26
27
# File 'lib/qonfig/command_set.rb', line 25

def add_command(command)
  thread_safe { commands << command }
end

#concat(command_set) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

Since:

  • 0.1.0



44
45
46
# File 'lib/qonfig/command_set.rb', line 44

def concat(command_set)
  thread_safe { commands.concat(command_set.commands) }
end

#dupQonfig::CommandSet

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

Since:

  • 0.2.0



52
53
54
55
56
# File 'lib/qonfig/command_set.rb', line 52

def dup
  thread_safe do
    self.class.new.tap { |duplicate| duplicate.concat(self) }
  end
end

#each(&block) ⇒ Enumerable

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • block (Proc)

Returns:

  • (Enumerable)

Since:

  • 0.1.0



35
36
37
# File 'lib/qonfig/command_set.rb', line 35

def each(&block)
  thread_safe { block_given? ? commands.each(&block) : commands.each }
end