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



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

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

.expand_path_relative(f) ⇒ Object



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

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

.relativize(f) ⇒ Object



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

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