Class: Kmkr::FileManager
- Inherits:
-
Object
- Object
- Kmkr::FileManager
- Defined in:
- lib/kmkr/file_manager.rb
Instance Attribute Summary collapse
-
#current_dir ⇒ Object
readonly
Returns the value of attribute current_dir.
Instance Method Summary collapse
- #create_file ⇒ Object
-
#initialize(prefix, extension, current_dir = Dir.pwd, suffix = "") ⇒ FileManager
constructor
A new instance of FileManager.
Constructor Details
#initialize(prefix, extension, current_dir = Dir.pwd, suffix = "") ⇒ FileManager
Returns a new instance of FileManager.
5 6 7 8 9 10 |
# File 'lib/kmkr/file_manager.rb', line 5 def initialize(prefix, extension, current_dir = Dir.pwd, suffix = "") @current_dir = current_dir @prefix = prefix @extension = extension @suffix = suffix end |
Instance Attribute Details
#current_dir ⇒ Object (readonly)
Returns the value of attribute current_dir.
3 4 5 |
# File 'lib/kmkr/file_manager.rb', line 3 def current_dir @current_dir end |
Instance Method Details
#create_file ⇒ Object
12 13 14 15 |
# File 'lib/kmkr/file_manager.rb', line 12 def create_file create_directory unless File.exist?(current_dir) File.new(filename, 'w').close unless File.exist?(filename) end |