Class: Aocli::Commands::StartDay
- Inherits:
-
Object
- Object
- Aocli::Commands::StartDay
- Defined in:
- lib/aocli/commands/start_day.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(date:, output_destination:) ⇒ StartDay
constructor
A new instance of StartDay.
- #run! ⇒ Object
Constructor Details
#initialize(date:, output_destination:) ⇒ StartDay
Returns a new instance of StartDay.
11 12 13 14 15 16 |
# File 'lib/aocli/commands/start_day.rb', line 11 def initialize(date:, output_destination:) @date = date @output_destination = output_destination @main_file_path = File.join(output_destination, date.year.to_s, "day_#{date.day}", "main.rb") @input_file_path = File.join(output_destination, date.year.to_s, "day_#{date.day}", "input.txt") end |
Class Method Details
.run!(options) ⇒ Object
4 5 6 7 8 9 |
# File 'lib/aocli/commands/start_day.rb', line 4 def self.run!() new( date: [:date], output_destination: [:output_destination], ).run! end |
Instance Method Details
#run! ⇒ Object
18 19 20 21 22 23 |
# File 'lib/aocli/commands/start_day.rb', line 18 def run! Aocli::FileUtils.touch_file(main_file_path) Aocli::FileUtils.touch_file(input_file_path) File.write(main_file_path, main_content) File.write(input_file_path, input_content) end |