Class: Rack::TrafficLogger::StreamSimulator

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/traffic_logger/stream_simulator.rb

Instance Method Summary collapse

Constructor Details

#initialize(color: false, pretty_print: false) ⇒ StreamSimulator

Returns a new instance of StreamSimulator.



5
6
7
8
# File 'lib/rack/traffic_logger/stream_simulator.rb', line 5

def initialize(color: false, pretty_print: false)
  @color = color
  @pretty_print = pretty_print
end

Instance Method Details

#format(input) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/rack/traffic_logger/stream_simulator.rb', line 10

def format(input)
  case input['event']
    when 'request' then format_request input
    when 'response' then format_response input
    else nil
  end
end