Class: RequestDetailsFormatter
- Inherits:
-
Object
- Object
- RequestDetailsFormatter
- Includes:
- RequestFormattable
- Defined in:
- lib/dtracer/request_formatters.rb
Instance Method Summary collapse
- #begin_section(_) ⇒ Object
- #body_section(hash) ⇒ Object
- #cookie_section(hash) ⇒ Object
- #header_section(hash) ⇒ Object
-
#initialize(hash, options) ⇒ RequestDetailsFormatter
constructor
A new instance of RequestDetailsFormatter.
- #joining_string ⇒ Object
- #method_section(hash) ⇒ Object
- #url_section(hash) ⇒ Object
Methods included from RequestFormattable
Constructor Details
permalink #initialize(hash, options) ⇒ RequestDetailsFormatter
Returns a new instance of RequestDetailsFormatter.
74 75 76 77 |
# File 'lib/dtracer/request_formatters.rb', line 74 def initialize(hash, ) @options = super(hash) end |
Instance Method Details
permalink #begin_section(_) ⇒ Object
[View source]
83 84 85 |
# File 'lib/dtracer/request_formatters.rb', line 83 def begin_section(_) [] end |
permalink #body_section(hash) ⇒ Object
[View source]
110 111 112 113 |
# File 'lib/dtracer/request_formatters.rb', line 110 def body_section(hash) return nil unless @options[:b] && hash["body"] ["Body:\n #{hash["body"]}"] end |
permalink #cookie_section(hash) ⇒ Object
[View source]
104 105 106 107 108 |
# File 'lib/dtracer/request_formatters.rb', line 104 def (hash) return nil unless @options[:c] && hash["cookies"] hash["cookies"].map { |name, value| " #{name}: #{value}" }.insert(0, "Cookies:") end |
permalink #header_section(hash) ⇒ Object
[View source]
98 99 100 101 102 |
# 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 |
permalink #joining_string ⇒ Object
[View source]
79 80 81 |
# File 'lib/dtracer/request_formatters.rb', line 79 def joining_string "\n" end |
permalink #method_section(hash) ⇒ Object
[View source]
87 88 89 90 91 |
# File 'lib/dtracer/request_formatters.rb', line 87 def method_section(hash) return nil unless @options[:m] && hash["method"] ["Method:\n #{hash["method"]}"] end |
permalink #url_section(hash) ⇒ Object
[View source]
93 94 95 96 |
# File 'lib/dtracer/request_formatters.rb', line 93 def url_section(hash) return nil unless @options[:u] && hash["url"] ["URL:\n #{hash["url"]}"] end |