class Scmd::StoredCommands

Attributes

hash[R]

Public Class Methods

new() click to toggle source
# File lib/scmd/stored_commands.rb, line 9
def initialize
  @hash = Hash.new{ |h, k| h[k] = Stub.new(k) }
end

Public Instance Methods

==(other) click to toggle source
Calls superclass method
# File lib/scmd/stored_commands.rb, line 33
def ==(other)
  if other.is_a?(StoredCommands)
    hash == other.hash
  else
    super
  end
end
add(cmd_str, &block) click to toggle source
# File lib/scmd/stored_commands.rb, line 13
def add(cmd_str, &block)
  @hash[cmd_str].tap{ |s| s.set_default_proc(&block) }
end
empty?() click to toggle source
# File lib/scmd/stored_commands.rb, line 29
def empty?
  @hash.empty?
end
get(cmd_str, opts = nil) click to toggle source
# File lib/scmd/stored_commands.rb, line 17
def get(cmd_str, opts = nil)
  @hash[cmd_str].call(opts)
end
remove(cmd_str) click to toggle source
# File lib/scmd/stored_commands.rb, line 21
def remove(cmd_str)
  @hash.delete(cmd_str)
end
remove_all() click to toggle source
# File lib/scmd/stored_commands.rb, line 25
def remove_all
  @hash.clear
end