Class: File
- Inherits:
-
Object
- Object
- File
- Defined in:
- lib/audio_addict/extensions/file.rb
Class Method Summary collapse
- .append(file, content) ⇒ Object
- .contains?(file, content) ⇒ Boolean
- .deep_write(file, content) ⇒ Object
Class Method Details
.append(file, content) ⇒ Object
15 16 17 |
# File 'lib/audio_addict/extensions/file.rb', line 15 def append(file, content) File.open(file, 'a') { |f| f << "#{content}\n" } end |
.contains?(file, content) ⇒ Boolean
5 6 7 8 9 10 11 12 13 |
# File 'lib/audio_addict/extensions/file.rb', line 5 def contains?(file, content) return false unless File.exist? file foreach file do |line| return true if line.chomp == content end false end |