Class: Qonfig::CommandSet Private

Inherits:
Object
  • Object
show all
Includes:
Enumerable
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

#initializevoid

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.

Since:

  • 0.1.0



20
21
22
23
# File 'lib/qonfig/command_set.rb', line 20

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



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

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



30
31
32
# File 'lib/qonfig/command_set.rb', line 30

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

#concat(command_set) {|command| ... } ⇒ 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:

Yields:

  • (command)

Yield Parameters:

Since:

  • 0.1.0

Version:

  • 0.19.0



53
54
55
56
57
58
59
60
61
# File 'lib/qonfig/command_set.rb', line 53

def concat(command_set, &concant_condition)
  thread_safe do
    if block_given?
      command_set.each { |command| (commands << command) if yield(command) }
    else
      command_set.each { |command| commands << command }
    end
  end
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



67
68
69
70
71
# File 'lib/qonfig/command_set.rb', line 67

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



40
41
42
# File 'lib/qonfig/command_set.rb', line 40

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