Class: PatternPark::FCSHProcess
Instance Attribute Summary collapse
-
#e ⇒ Object
readonly
Returns the value of attribute e.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#r ⇒ Object
readonly
Returns the value of attribute r.
-
#w ⇒ Object
readonly
Returns the value of attribute w.
Instance Method Summary collapse
-
#initialize(target, path) ⇒ FCSHProcess
constructor
A new instance of FCSHProcess.
- #puts(msg) ⇒ Object
- #read ⇒ Object
Constructor Details
#initialize(target, path) ⇒ FCSHProcess
Returns a new instance of FCSHProcess.
117 118 119 120 121 122 123 124 |
# File 'lib/airake/fcshd.rb', line 117 def initialize(target, path) @target = target @path = path start = Dir.pwd Dir.chdir(path) @w, @r, @e = Open3.popen3(target) Dir.chdir(start) end |
Instance Attribute Details
#e ⇒ Object (readonly)
Returns the value of attribute e.
115 116 117 |
# File 'lib/airake/fcshd.rb', line 115 def e @e end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
115 116 117 |
# File 'lib/airake/fcshd.rb', line 115 def path @path end |
#r ⇒ Object (readonly)
Returns the value of attribute r.
115 116 117 |
# File 'lib/airake/fcshd.rb', line 115 def r @r end |
#w ⇒ Object (readonly)
Returns the value of attribute w.
115 116 117 |
# File 'lib/airake/fcshd.rb', line 115 def w @w end |
Instance Method Details
#puts(msg) ⇒ Object
126 127 128 |
# File 'lib/airake/fcshd.rb', line 126 def puts(msg) @w.puts(msg) end |
#read ⇒ Object
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/airake/fcshd.rb', line 130 def read line = '' response = '' while(!r.eof?) char = r.getc.chr line += char if (line == '(fcsh)') response += "[PROMPT] #{line}" break end if (char == "\n") response += "[FCSH] #{line}" line = '' end end return response end |