class Pilfer::Logger

Attributes

app_root[R]
logger[R]

Public Class Methods

new(path_or_io, options = {}) click to toggle source
# File lib/pilfer/logger.rb, line 8
def initialize(path_or_io, options = {})
  @logger = ::Logger.new(path_or_io)
  if (app_root = options[:app_root])
    app_root += '/' unless app_root[-1, 1] == '/'
    @app_root = %r{^#{Regexp.escape(app_root)}}
  end
end

Public Instance Methods

write(profile_data, profile_start, description, options = {}) click to toggle source
# File lib/pilfer/logger.rb, line 16
def write(profile_data, profile_start, description, options = {})
  profile = Pilfer::Profile.new(profile_data, profile_start)
  print_report_banner profile_start, description
  profile.each do |path, data|
    print_file_banner path, data
    print_file_source_with_profile path, data
  end
end

Private Instance Methods

print_file_banner(path, data) click to toggle source
print_file_source_with_profile(path, data) click to toggle source
print_report_banner(profile_start, description) click to toggle source
strip_app_root(path) click to toggle source
# File lib/pilfer/logger.rb, line 57
def strip_app_root(path)
  return path unless app_root
  path.gsub(app_root, '')
end