Class: Logs

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/docfolio/logs.rb

Overview

collection class for Learning Diarys / logs

Instance Method Summary collapse

Constructor Details

#initializeLogs

iterates through every file in the data directory and parses with

LearningDiary


10
11
12
# File 'lib/docfolio/logs.rb', line 10

def initialize
  @logs = []
end

Instance Method Details

#add(file_or_directory) ⇒ Object

Adds either a file to logs or a directory to logs

Parameters:

  • file_or_directory (String)

    A string containing the name of a file or directory



17
18
19
20
# File 'lib/docfolio/logs.rb', line 17

def add(file_or_directory)
  log_directory(file_or_directory) if File.directory?(file_or_directory)
  log_file(file_or_directory) if File.file?(file_or_directory)
end

#each(&block) ⇒ Object

Implements Enumerable by iterating through each learning diary



23
24
25
# File 'lib/docfolio/logs.rb', line 23

def each(&block)
  @logs.each { |p| block.call(p) }
end