Class: File

Inherits:
Object show all
Defined in:
lib/pretty_debug.rb

Overview

File

Class Method Summary collapse

Class Method Details

.add(f, s) ⇒ Object



13
14
15
16
17
18
# File 'lib/pretty_debug.rb', line 13

def self.add f, s
  open(f, "a+") do |io|
    io.readlines.last.tap{|l| io.puts if l && l.end_with?($/).!}
    io.write(s)
  end
end

.expand_path_relative(f) ⇒ Object



12
# File 'lib/pretty_debug.rb', line 12

def self.expand_path_relative f; expand_path(f, caller_location(1).dirname) end

.relativize(f) ⇒ Object



11
# File 'lib/pretty_debug.rb', line 11

def self.relativize f; f.sub(%r{\A/}, "") end