Class: OggEncode::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/autogg/utils.rb

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ Logger

Returns a new instance of Logger.



49
50
51
52
# File 'lib/autogg/utils.rb', line 49

def initialize(location)
  @log = File.new("#{location}autogg.log", "w+")
  @log.puts "This is the log of excluded files for the most recently run autogg \n\n"
end

Instance Method Details

#<<(path) ⇒ Object



54
55
56
# File 'lib/autogg/utils.rb', line 54

def <<(path)
  @log.puts "#{parent(path)} -- #{File.basename(path)}"
end

#closeObject



58
59
60
# File 'lib/autogg/utils.rb', line 58

def close
  @log.close
end

#parent(path) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/autogg/utils.rb', line 35

def parent(path)
  n = 0
  result = ""
  path.reverse.each_char do |c|
    n += 1 if c == '/'
    if n == 1
      result << c
    elsif n >= 2
      break
    end
  end
  return result.reverse
end