Module: RequestFormattable

Included in:
RequestCurlFormatter, RequestDetailsFormatter
Defined in:
lib/dtracer/request_formatters.rb

Instance Method Summary collapse

Instance Method Details

#generateObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/dtracer/request_formatters.rb', line 12

def generate
  arr = []

  methods = [:begin_section, :method_section, :body_section,
             :cookie_section, :header_section, :url_section]

  methods.each do |method_name|
    # get content array for a request section
    content_array = self.send(method_name, @hash)
    arr.concat(content_array) if content_array

  end

  @content = arr.join(joining_string)
end

#initialize(hash) ⇒ Object



3
4
5
6
# File 'lib/dtracer/request_formatters.rb', line 3

def initialize(hash)
  @hash = hash
  generate
end

#to_sObject



8
9
10
# File 'lib/dtracer/request_formatters.rb', line 8

def to_s
  @content
end