Class: SmartCore::Container::CommandSet Private
- Inherits:
-
Object
- Object
- SmartCore::Container::CommandSet
- Includes:
- Enumerable
- Defined in:
- lib/smart_core/container/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<SmartCore::Container::Commands::Base> readonly private
Instance Method Summary collapse
- #add_command(command) ⇒ void (also: #<<) private
- #clear ⇒ void private
- #concat(command_set) ⇒ void private
- #dup ⇒ SmartCore::Operation::AttributeSet private
- #each {|SmartCore::Container::Commands::Base| ... } ⇒ Enumerable private
-
#initialize ⇒ CommandSet
constructor
private
A new instance of CommandSet.
Constructor Details
#initialize ⇒ 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 a new instance of CommandSet.
17 18 19 20 |
# File 'lib/smart_core/container/command_set.rb', line 17 def initialize @commands = [] @access_lock = Mutex.new end |
Instance Attribute Details
#commands ⇒ Array<SmartCore::Container::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.
13 14 15 |
# File 'lib/smart_core/container/command_set.rb', line 13 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.
27 28 29 |
# File 'lib/smart_core/container/command_set.rb', line 27 def add_command(command) thread_safe { commands << command } end |
#clear ⇒ 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.
68 69 70 |
# File 'lib/smart_core/container/command_set.rb', line 68 def clear thread_safe { commands.clear } 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.
46 47 48 |
# File 'lib/smart_core/container/command_set.rb', line 46 def concat(command_set) thread_safe { commands.concat(command_set.dup.commands) } end |
#dup ⇒ SmartCore::Operation::AttributeSet
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.
54 55 56 57 58 59 60 61 62 |
# File 'lib/smart_core/container/command_set.rb', line 54 def dup thread_safe do self.class.new.tap do |duplicate| commands.each do |command| duplicate.add_command(command.dup) end end end end |
#each {|SmartCore::Container::Commands::Base| ... } ⇒ 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.
37 38 39 |
# File 'lib/smart_core/container/command_set.rb', line 37 def each(&block) thread_safe { block_given? ? commands.each(&block) : commands.each } end |