Class: FileManager
- Inherits:
-
Object
- Object
- FileManager
- Defined in:
- lib/fundamentus_data/util/file_manager.rb
Instance Method Summary collapse
-
#initialize(dir_path, options = {}) ⇒ FileManager
constructor
A new instance of FileManager.
- #save(file_name, content) ⇒ Object
Constructor Details
#initialize(dir_path, options = {}) ⇒ FileManager
Returns a new instance of FileManager.
5 6 7 8 9 10 |
# File 'lib/fundamentus_data/util/file_manager.rb', line 5 def initialize(dir_path, = {}) @dir_path = dir_path if .has_key?(:verbose) @verbose = [:verbose] end end |
Instance Method Details
#save(file_name, content) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/fundamentus_data/util/file_manager.rb', line 12 def save(file_name, content) if @verbose puts "Saving content of length #{content.size} to #{@dir_path + file_name}" end File.open(@dir_path + file_name, 'w') do |f| f.write(content) end end |