class Scmd::StoredCommands::Stub
Attributes
cmd_str[R]
hash[R]
Public Class Methods
new(cmd_str)
click to toggle source
# File lib/scmd/stored_commands.rb, line 44 def initialize(cmd_str) @cmd_str = cmd_str @default_proc = proc{ |cmd_spy| } # no-op @hash = {} end
Public Instance Methods
==(other)
click to toggle source
Calls superclass method
# File lib/scmd/stored_commands.rb, line 64 def ==(other) if other.is_a?(Stub) cmd_str == other.cmd_str && hash == other.hash else super end end
call(opts)
click to toggle source
# File lib/scmd/stored_commands.rb, line 59 def call(opts) block = @hash[opts] || @default_proc CommandSpy.new(@cmd_str, opts).tap(&block) end
set_default_proc(&block)
click to toggle source
# File lib/scmd/stored_commands.rb, line 50 def set_default_proc(&block) @default_proc = block if block end
with(opts, &block)
click to toggle source
# File lib/scmd/stored_commands.rb, line 54 def with(opts, &block) @hash[opts] = block self end