Class: AocCli::Processors::EventInitialiser

Inherits:
Core::Processor show all
Defined in:
lib/aoc_cli/processors/event_initialiser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Core::Processor

#run!, run!

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



8
9
10
# File 'lib/aoc_cli/processors/event_initialiser.rb', line 8

def dir
  @dir
end

#yearObject

Returns the value of attribute year.



8
9
10
# File 'lib/aoc_cli/processors/event_initialiser.rb', line 8

def year
  @year
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
# File 'lib/aoc_cli/processors/event_initialiser.rb', line 17

def run
  create_event!.tap do |event|
    initialise_stats!(event)
    make_event_directory!
    attach_event!(event)
  end
end

#validateObject

TODO: use conditional validation once supported by Kangaru



11
12
13
14
15
# File 'lib/aoc_cli/processors/event_initialiser.rb', line 11

def validate
  super
  validate_event_not_already_initialised! if errors.empty?
  validate_event_dir_does_not_exist! if errors.empty?
end