Class: GroongaQueryLog::Command::Extract::InspectFormatter
- Inherits:
- 
      Object
      
        - Object
- GroongaQueryLog::Command::Extract::InspectFormatter
 
- Defined in:
- lib/groonga-query-log/command/extract.rb
Instance Method Summary collapse
- #command(statistic, command_text) ⇒ Object
- #finish ⇒ Object
- 
  
    
      #initialize(output)  ⇒ InspectFormatter 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of InspectFormatter. 
- #start ⇒ Object
Constructor Details
#initialize(output) ⇒ InspectFormatter
Returns a new instance of InspectFormatter.
| 201 202 203 204 | # File 'lib/groonga-query-log/command/extract.rb', line 201 def initialize(output) @output = output @first_comand = false end | 
Instance Method Details
#command(statistic, command_text) ⇒ Object
| 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | # File 'lib/groonga-query-log/command/extract.rb', line 210 def command(statistic, command_text) if @first_command @first_command = false else @output.puts(",") end record = { "start_time" => statistic.start_time, "elapsed_time" => statistic.elapsed_in_seconds, "last_time" => statistic.last_time, "return_code" => statistic.return_code, "command" => command_text, } statistic.command.arguments.each do |name, value| record["argument_#{name}"] = value end @output.print(record.to_json) end | 
#finish ⇒ Object
| 229 230 231 232 | # File 'lib/groonga-query-log/command/extract.rb', line 229 def finish @output.puts("") unless @first_comand @output.puts("]") end | 
#start ⇒ Object
| 206 207 208 | # File 'lib/groonga-query-log/command/extract.rb', line 206 def start @output.puts("[") end |