Class: Warp::Dir::App::Response::Type
- Defined in:
- lib/warp/dir/app/response.rb
Overview
Use Case exit code stream
Information / Help / List 0 STDOUT Error occurred 1 STDERR Execute Shell Command 2 STDOUT
Instance Attribute Summary collapse
-
#exit_code ⇒ Object
Returns the value of attribute exit_code.
-
#stream ⇒ Object
Returns the value of attribute stream.
Instance Method Summary collapse
Instance Attribute Details
#exit_code ⇒ Object
Returns the value of attribute exit_code
14 15 16 |
# File 'lib/warp/dir/app/response.rb', line 14 def exit_code @exit_code end |
#stream ⇒ Object
Returns the value of attribute stream
14 15 16 |
# File 'lib/warp/dir/app/response.rb', line 14 def stream @stream end |
Instance Method Details
#print(msg) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/warp/dir/app/response.rb', line 15 def print(msg) under_shell = ::Warp::Dir.eval_context? if msg == ' ' under_shell ? stream.printf(%Q{printf '\\n'; }) : stream.printf("\n") else msg.split("\n").each do |line| under_shell ? stream.printf(%Q{printf -- '#{line.gsub(/['`]/, '\"')}\\n';}) : stream.printf("#{line}\n") end end end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/warp/dir/app/response.rb', line 26 def to_s "code:#{exit_code}, stream:#{stream == $stdout ? "STDOUT" : "STDERR"}" end |