Class: EacFs::Logs
- Defined in:
- lib/eac_fs/logs.rb,
lib/eac_fs/logs/file.rb
Defined Under Namespace
Classes: File
Instance Method Summary collapse
- #[](label) ⇒ EacRubyUtils::Fs::Temp::File
- #add(label) ⇒ EacFs::Logs
- #clean_all ⇒ EacFs::Logs
- #remove(label) ⇒ Object
- #remove_all ⇒ EacFs::Logs
- #truncate_all(length = ::EacFs::Logs::File::TRUNCATE_DEFAULT_LENGTH) ⇒ String
Instance Method Details
#[](label) ⇒ EacRubyUtils::Fs::Temp::File
13 14 15 |
# File 'lib/eac_fs/logs.rb', line 13 def [](label) log_set.fetch(sanitize_label(label)).file end |
#add(label) ⇒ EacFs::Logs
19 20 21 22 23 24 |
# File 'lib/eac_fs/logs.rb', line 19 def add(label) file = ::EacFs::Logs::File.new(sanitize_label(label)) log_set[file.label] = file self end |
#clean_all ⇒ EacFs::Logs
27 28 29 |
# File 'lib/eac_fs/logs.rb', line 27 def clean_all log_set.each_value(&:clean) end |
#remove(label) ⇒ Object
39 40 41 42 |
# File 'lib/eac_fs/logs.rb', line 39 def remove(label) log_set.fetch(sanitize_label(label)).remove log_set.delete(sanitize_label(label)) end |
#remove_all ⇒ EacFs::Logs
32 33 34 35 36 |
# File 'lib/eac_fs/logs.rb', line 32 def remove_all log_set.each_key { |label| remove(label) } self end |
#truncate_all(length = ::EacFs::Logs::File::TRUNCATE_DEFAULT_LENGTH) ⇒ String
46 47 48 49 |
# File 'lib/eac_fs/logs.rb', line 46 def truncate_all(length = ::EacFs::Logs::File::TRUNCATE_DEFAULT_LENGTH) "Files: #{log_set.length}\n" + log_set.values.map { |file| file.truncate_with_label(length) }.join end |