class DTracer::CLI
Public Instance Methods
curl()
click to toggle source
# File lib/dtracer/cli.rb, line 12 def curl say "Starting dtrace", :green t1 = Thread.new do ProbeListener.new("request", true).listen do |hash| puts RequestCurlFormatter.new(hash).to_s end end t2 = Thread.new do sleep(0.3) add_response_probe if options[:r] end t1.join t2.join rescue Exception => ex say ex.message, :red end
custom()
click to toggle source
# File lib/dtracer/cli.rb, line 80 def custom say "Starting dtrace", :green probe = ProbeListener.new("custom", false) probe.listen do |string| puts string end rescue Exception => ex say ex.message, :red end
details()
click to toggle source
# File lib/dtracer/cli.rb, line 41 def details options_without_response = options.dup options_without_response.delete(:r) raise "Select any option from -b, -c, -h, -u (you can combine them for more info)" if options_without_response.empty? say "Starting dtrace", :green t1 = Thread.new do ProbeListener.new("request", true).listen do |hash| puts RequestDetailsFormatter.new(hash, options || {}).to_s end end t2 = Thread.new do sleep(0.3) add_response_probe if options[:r] end t1.join t2.join rescue Exception => ex say ex.message, :red end
response()
click to toggle source
# File lib/dtracer/cli.rb, line 69 def response say "Starting dtrace", :green add_response_probe rescue Exception => ex say ex.message, :red end
Private Instance Methods
add_response_probe()
click to toggle source
# File lib/dtracer/cli.rb, line 96 def add_response_probe probe = ProbeListener.new("response", true) probe.listen do |hash| formatter = ResponseFormatter.new(hash) puts formatter.to_s end end