class GroongaQueryLog::CommandLine

Private Instance Methods

parse_log(parser, log_paths, &process_statistic) click to toggle source
# File lib/groonga-query-log/command-line.rb, line 26
def parse_log(parser, log_paths, &process_statistic)
  return to_enum(__method__, parser, log_paths) unless block_given?
  if log_paths.empty?
    if stdin_with_pipe? or stdin_with_redirect?
      parser.parse($stdin, &process_statistic)
    else
      raise NoInputError, "Error: Please specify input log files."
    end
  else
    parser.parse_paths(log_paths, &process_statistic)
  end
end
stdin_with_pipe?() click to toggle source
# File lib/groonga-query-log/command-line.rb, line 39
def stdin_with_pipe?
  File.pipe?($stdin)
end
stdin_with_redirect?() click to toggle source
# File lib/groonga-query-log/command-line.rb, line 43
def stdin_with_redirect?
  not File.select([$stdin], [], [], 0).nil?
end