Sha256: 9bd36b5b512ab76bd5c4eb7920c77bd506886bfaf006a493b10b5a5f36cd8a01

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

#!/usr/bin/env ruby

def abort
  puts 'Usage: rubyx <file> [arguments]'
  exit 1
end

filename = ARGV.shift || ''
abort if filename.empty?

filename = File.absolute_path(filename)

unless File.exist?(filename)
  puts 'The file does not exist.'
  exit 1
end

lines = File.readlines(filename)
previous = 0

trace = Proc.new do |event, file, current|
  if event == 'line' && file == filename && current > previous
    (previous..(current - 1)).each do |i|
      puts "+ #{lines[i]}"
    end
    previous = current
  end
end

set_trace_func(trace)
require filename

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubyx-0.0.1 bin/rubyx