module Ripcols

Constants

VERSION

Private Class Methods

caller_files() click to toggle source

Like Kernel#caller but excluding certain magic entries and without line / method information; the resulting array contains filenames only.

# File lib/ripcols.rb, line 46
def self.caller_files
  cleaned_caller(1).flatten
end
cleaned_caller(keep = 3) click to toggle source

Like Kernel#caller but excluding certain magic entries

# File lib/ripcols.rb, line 61
def self.cleaned_caller(keep = 3)
  Kernel.caller(1).
    map!    { |line| line.split(/:(?=\d|in )/, 3)[0,keep] }.
    reject { |file, *_| CALLERS_TO_IGNORE.any? { |pattern| file =~ pattern } }
end
file_contents(f) click to toggle source

here for future, in case we need to do some preprocessing on file

# File lib/ripcols.rb, line 32
def self.file_contents f
  # until f.eof? || ((ch = f.readchar) != "\n")
  # end
  # ch && f.ungetc(ch)
  # f.pos = [f.pos.pred, 0].max
  f.read
end