Class: Nomadize::FileGenerator
- Inherits:
-
Object
- Object
- Nomadize::FileGenerator
- Defined in:
- lib/nomadize/file_generator.rb
Instance Method Summary collapse
-
#initialize(path:, name:, timestamp: DateTime.now.new_offset(0).strftime("%Y%m%d%H%M%S")) ⇒ FileGenerator
constructor
A new instance of FileGenerator.
- #save ⇒ Object
Constructor Details
#initialize(path:, name:, timestamp: DateTime.now.new_offset(0).strftime("%Y%m%d%H%M%S")) ⇒ FileGenerator
Returns a new instance of FileGenerator.
9 10 11 12 13 |
# File 'lib/nomadize/file_generator.rb', line 9 def initialize(path:, name:, timestamp: DateTime.now.new_offset(0).strftime("%Y%m%d%H%M%S")) @path = path @name = name @timestamp = end |
Instance Method Details
#save ⇒ Object
15 16 17 18 19 20 |
# File 'lib/nomadize/file_generator.rb', line 15 def save FileUtils.mkdir_p path unless File.exists?(path) migration_file = File.join(path, ) File.open(File.join(path, ), "w") { |f| f.write(template_content) } migration_file end |