Class: Logs
Overview
collection class for Learning Diarys / logs
Instance Method Summary collapse
-
#add(file_or_directory) ⇒ Object
Adds either a file to logs or a directory to logs.
-
#each(&block) ⇒ Object
Implements Enumerable by iterating through each learning diary.
-
#initialize ⇒ Logs
constructor
iterates through every file in the data directory and parses with LearningDiary.
Constructor Details
#initialize ⇒ Logs
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
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 |