Class: Qonfig::CommandSet Private
- Inherits:
-
Object
- Object
- Qonfig::CommandSet
- 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.
Instance Attribute Summary collapse
- #commands ⇒ Array<Qonfig::Commands::Base> readonly private
Instance Method Summary collapse
- #add_command(command) ⇒ void (also: #<<) private
- #concat(command_set) {|command| ... } ⇒ void private
- #dup ⇒ Qonfig::CommandSet private
- #each(&block) ⇒ Enumerable private
- #initialize ⇒ void constructor private
Constructor Details
#initialize ⇒ 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.
20 21 22 23 |
# File 'lib/qonfig/command_set.rb', line 20 def initialize @commands = [] @access_lock = Mutex.new end |
Instance Attribute Details
#commands ⇒ Array<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.
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.
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.
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 |
#dup ⇒ Qonfig::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.
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.
40 41 42 |
# File 'lib/qonfig/command_set.rb', line 40 def each(&block) thread_safe { block_given? ? commands.each(&block) : commands.each } end |