class SiteguardLite::Log::CLI
Public Class Methods
new(options)
click to toggle source
# File lib/siteguard_lite/log/cli.rb, line 4 def initialize(options) @type = options.delete(:type) @format = options.delete(:format) @parser = SiteguardLiteLogParser.new(@type, options) end
Public Instance Methods
run()
click to toggle source
# File lib/siteguard_lite/log/cli.rb, line 10 def run while line = STDIN.gets line.chomp! result = @parser.parse(line) puts format(result) end end
Private Instance Methods
format(h)
click to toggle source
# File lib/siteguard_lite/log/cli.rb, line 20 def format(h) case @format when 'ltsv' require 'ltsv' LTSV.dump(h) else raise ArgumentError, "Unexpected output format: #{@format}" end end