class SSHake::Mock::CommandSet

Public Class Methods

new() click to toggle source
# File lib/sshake/mock/command_set.rb, line 9
def initialize
  @commands = []
end

Public Instance Methods

add(matcher, &block) click to toggle source
# File lib/sshake/mock/command_set.rb, line 13
def add(matcher, &block)
  command = Command.new(matcher, &block)
  @commands << command
  command
end
match(given_command) click to toggle source
# File lib/sshake/mock/command_set.rb, line 19
def match(given_command)
  @commands.each do |command|
    if matches = command.match(given_command)
      return [command, matches]
    end
  end
  nil
end