class Session::Command
Attributes
begin_err[R]
begin_err_pat[R]
begin_out[R]
begin_out_pat[R]
cid[R]
cmd[R]
attributes
cmdno[R]
end_err[R]
end_err_pat[R]
end_out[R]
end_out_pat[R]
err[RW]
out[RW]
Public Class Methods
cmdno()
click to toggle source
# File lib/session.rb, line 39 def cmdno; @cmdno ||= 0; end
cmdno=(n;)
click to toggle source
# File lib/session.rb, line 40 def cmdno= n; @cmdno = n; end
new(command)
click to toggle source
# File lib/session.rb, line 58 def initialize(command) @cmd = command.to_s @cmdno = self.class.cmdno self.class.cmdno += 1 @err = '' @out = '' @cid = "%d_%d_%d" % [$$, cmdno, rand(Time.now.usec)] @begin_out = "__CMD_OUT_%s_BEGIN__" % cid @end_out = "__CMD_OUT_%s_END__" % cid @begin_out_pat = %r/#{ Regexp.escape(@begin_out) }/ @end_out_pat = %r/#{ Regexp.escape(@end_out) }/ @begin_err = "__CMD_ERR_%s_BEGIN__" % cid @end_err = "__CMD_ERR_%s_END__" % cid @begin_err_pat = %r/#{ Regexp.escape(@begin_err) }/ @end_err_pat = %r/#{ Regexp.escape(@end_err) }/ end
Public Instance Methods
to_hash()
click to toggle source
# File lib/session.rb, line 74 def to_hash %w(cmdno cmd out err cid).inject({}){|h,k| h.update k => send(k) } end