Class: Everhour2toggl::FileGenerator
- Inherits:
-
Object
- Object
- Everhour2toggl::FileGenerator
- Defined in:
- lib/everhour2toggl/file_generator.rb
Instance Method Summary collapse
- #generate(str) ⇒ Object
-
#initialize(output:, filename:) ⇒ FileGenerator
constructor
A new instance of FileGenerator.
Constructor Details
#initialize(output:, filename:) ⇒ FileGenerator
Returns a new instance of FileGenerator.
5 6 7 8 |
# File 'lib/everhour2toggl/file_generator.rb', line 5 def initialize(output:, filename:) @output = output @filename = filename end |
Instance Method Details
#generate(str) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/everhour2toggl/file_generator.rb', line 10 def generate(str) FileUtils.mkdir_p("#{@output}") File.open("#{Dir.pwd}/#{@output}/#{@filename}", "w") do |file| file.puts(str) end end |