Class: Rack::TrafficLogger::Formatter::JSON
- Inherits:
-
Rack::TrafficLogger::Formatter
- Object
- Rack::TrafficLogger::Formatter
- Rack::TrafficLogger::Formatter::JSON
- Defined in:
- lib/rack/traffic_logger/formatter/json.rb
Instance Method Summary collapse
-
#initialize(pretty_print: false) ⇒ JSON
constructor
A new instance of JSON.
Methods inherited from Rack::TrafficLogger::Formatter
Constructor Details
#initialize(pretty_print: false) ⇒ JSON
Returns a new instance of JSON.
8 9 10 11 12 13 |
# File 'lib/rack/traffic_logger/formatter/json.rb', line 8 def initialize(pretty_print: false) formatter = pretty_print ? -> hash { ::JSON.pretty_generate(hash) << "\n" } : -> hash { ::JSON.generate(hash) << "\n" } define_singleton_method :format, formatter end |