Sha256: e6660956c7bc8e8e0171329fe5b683ce00dd572a12d8f46dcc095eba89335277

Contents?: true

Size: 579 Bytes

Versions: 1

Compression:

Stored size: 579 Bytes

Contents

module Wukong
  module Widget

    class Monitor < AsIs
      include CountingProcessor
      register_processor

      field :every, Integer, :default => 1000, :doc => "How often to announce progress"

      def process(rec)
        super(rec)
        $stderr.puts("%-7d\t%s\t%s" % [count, report, rec.inspect[0..1000]]) if ready?
      end

      def ready?
        (count % every) == 0
      end
    end

    class DumpSystemConfig < Monitor
      def setup ; require 'rbconfig' ;  end
      def report() super.merge({ :rbconfig => RbConfig::CONFIG })  end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wukong-3.0.0.pre lib/wukong/widget/monitor.rb