# warning_hunter
#   Support to remove ruby's warnings in our code
# Copyright (c) 2013 Kenichi Kamiya

require 'stringio'
require 'strscan'

=begin
WarningHunter.hunt do
  require 'mylib'
  require 'example'
end

#=> Output reports so easy reading :)
=end

module WarningHunter

  VERSION = '0.0.1'.freeze

  class WarningsParser

    def initialize(str)
      @scanner = StringScanner.new str.dup
    end

    def parse
    end

  end

  class << self

    def hunt
      before_stderr = $stderr
      $stderr = hunter_trap = StringIO.new
      before_verbose = $VERBOSE
      $VERBOSE = true
      yield
      report hunter_trap.rewind.read
    ensure
      $stderr = before_stderr
      $VERBOSE = before_verbose
    end

    private

    def report(str)

    end

  end

end