class Herokulogs::CLI

Public Class Methods

new() click to toggle source
# File lib/herokulogs/cli.rb, line 3
def initialize
  @formatter = Formatter.new(ARGV.first)
  @guard = Regexp.new(ARGV[1] || "")

  puts "herokulogs output format: #{@formatter.output_format.join(" ")}"
  puts "herokulogs guard: #{@guard.inspect}" if @guard != //
end

Public Instance Methods

run!() click to toggle source
# File lib/herokulogs/cli.rb, line 11
def run!
  STDIN.each do |line|
    if line.match(@guard)
      formatted = @formatter.format(line.chomp)
      puts formatted if formatted
    end
  end
end