Sha256: eed71b22fc91f5a174e917540a98e96bc3e232377fdadd11c1d38850988e3606

Contents?: true

Size: 519 Bytes

Versions: 5

Compression:

Stored size: 519 Bytes

Contents

require 'pp'
require 'freighthopper/define_and_alias'
module Kernel
  def self.trace_output() @@trace_output ||= false end
  def self.trace_output=(t) @@trace_output = t end
  %w(print pp p puts).each do |method|
    define_and_alias method, :source_and_passthrough do |*args|
      puts_without_source_and_passthrough caller.first if Kernel.trace_output
      send :"#{method}_without_source_and_passthrough", *args
      puts_without_source_and_passthrough if Kernel.trace_output
      return *args
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
freighthopper-0.1.14 lib/freighthopper/stdout_extensions.rb
freighthopper-0.1.13 lib/freighthopper/stdout_extensions.rb
freighthopper-0.1.12 lib/freighthopper/stdout_extensions.rb
freighthopper-0.1.11 lib/freighthopper/stdout_extensions.rb
freighthopper-0.1.9 lib/freighthopper/stdout_extensions.rb