Class: Everhour2toggl::FileGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/everhour2toggl/file_generator.rb

Instance Method Summary collapse

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