class GroongaQueryLog::Command::CheckCrash

Public Class Methods

new() click to toggle source
# File lib/groonga-query-log/command/check-crash.rb, line 25
def initialize
  setup_options
end

Public Instance Methods

run(arguments) click to toggle source
# File lib/groonga-query-log/command/check-crash.rb, line 29
def run(arguments)
  begin
    log_paths = @option_parser.parse!(arguments)
  rescue OptionParser::InvalidOption => error
    $stderr.puts(error)
    return false
  end

  begin
    check(log_paths)
  rescue Interrupt
  rescue Error
    $stderr.puts($!.message)
    return false
  end

  true
end

Private Instance Methods

check(log_paths) click to toggle source
# File lib/groonga-query-log/command/check-crash.rb, line 68
def check(log_paths)
  checker = Checker.new(log_paths)
  checker.check
end
open_output() { |$stdout| ... } click to toggle source
# File lib/groonga-query-log/command/check-crash.rb, line 58
def open_output
  if @options[:output] == "-"
    yield($stdout)
  else
    File.open(@options[:output], "w") do |output|
      yield(output)
    end
  end
end
setup_options() click to toggle source
# File lib/groonga-query-log/command/check-crash.rb, line 49
def setup_options
  @options = {}

  @option_parser = OptionParser.new do |parser|
    parser.version = VERSION
    parser.banner += " LOG1 ..."
  end
end