class SmartCore::Validator::CommandSet

@api private @since 0.1.0

Attributes

commands[R]

@return [Array<SmartCore::Validator::Commands::Base>]

@api private @since 0.1.0

Public Class Methods

new() click to toggle source

@api private @since 0.1.0

# File lib/smart_core/validator/command_set.rb, line 17
def initialize
  @commands = []
  @access_lock = Mutex.new
end

Public Instance Methods

<<(command)
Alias for: add_command
add_command(command) click to toggle source

@param command [SmartCore::Validator::Commands::Base] @return [void]

@api private @since 0.1.0

# File lib/smart_core/validator/command_set.rb, line 27
def add_command(command)
  thread_safe { commands << command }
end
Also aliased as: <<
clear() click to toggle source

@return [void]

@api private @since 0.1.0

# File lib/smart_core/validator/command_set.rb, line 54
def clear
  thread_safe { commands.clear }
end
concat(command_set) click to toggle source

@param command_set [SmartCore::Validator::CommandSet] @return [void]

@api private @since 0.1.0

# File lib/smart_core/validator/command_set.rb, line 46
def concat(command_set)
  thread_safe { commands.concat(command_set.commands) }
end
each(&block) click to toggle source

@yield [SmartCore::Validator::Commands::Base] @return [Enumerable]

@api private @since 0.1.0

# File lib/smart_core/validator/command_set.rb, line 37
def each(&block)
  thread_safe { block_given? ? commands.each(&block) : commands.each }
end

Private Instance Methods

thread_safe(&block) click to toggle source

@param block [Proc] @return [Any]

@api private @since 0.1.0

# File lib/smart_core/validator/command_set.rb, line 65
def thread_safe(&block)
  @access_lock.synchronize(&block)
end