class RequestDetailsFormatter

Public Class Methods

new(hash, options) click to toggle source
Calls superclass method RequestFormattable::new
# File lib/dtracer/request_formatters.rb, line 74
def initialize(hash, options)
  @options = options
  super(hash)
end

Public Instance Methods

begin_section(_) click to toggle source
# File lib/dtracer/request_formatters.rb, line 83
def begin_section(_)
  []
end
body_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 110
def body_section(hash)
  return nil unless @options[:b] && hash["body"]
  ["Body:\n  #{hash["body"]}"]
end
header_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 98
def header_section(hash)
  return nil unless @options[:h] && hash["headers"]

  hash["headers"].map { |key, value| "  #{key}: #{value}" }.insert(0, "Headers:")
end
joining_string() click to toggle source
# File lib/dtracer/request_formatters.rb, line 79
def joining_string
  "\n"
end
method_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 87
def method_section(hash)
  return nil unless @options[:m] && hash["method"]

  ["Method:\n  #{hash["method"]}"]
end
url_section(hash) click to toggle source
# File lib/dtracer/request_formatters.rb, line 93
def url_section(hash)
  return nil unless @options[:u] && hash["url"]
  ["URL:\n  #{hash["url"]}"]
end