Class: AocCli::Commands::DayInit
- Inherits:
-
Object
- Object
- AocCli::Commands::DayInit
- Defined in:
- lib/aoc_cli/commands.rb
Instance Attribute Summary collapse
-
#day ⇒ Object
readonly
Returns the value of attribute day.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
- #defaults ⇒ Object
- #exec ⇒ Object
-
#initialize(args) ⇒ DayInit
constructor
A new instance of DayInit.
- #respond ⇒ Object
Constructor Details
#initialize(args) ⇒ DayInit
Returns a new instance of DayInit.
42 43 44 45 46 47 |
# File 'lib/aoc_cli/commands.rb', line 42 def initialize(args) args = defaults.merge(args).compact @user = args[:user] @year = args[:year] @day = args[:day] end |
Instance Attribute Details
#day ⇒ Object (readonly)
Returns the value of attribute day.
41 42 43 |
# File 'lib/aoc_cli/commands.rb', line 41 def day @day end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
41 42 43 |
# File 'lib/aoc_cli/commands.rb', line 41 def user @user end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
41 42 43 |
# File 'lib/aoc_cli/commands.rb', line 41 def year @year end |
Instance Method Details
#defaults ⇒ Object
53 54 55 56 |
# File 'lib/aoc_cli/commands.rb', line 53 def defaults { user:Metafile.get(:user), year:Metafile.get(:year) } end |
#exec ⇒ Object
48 49 50 51 52 |
# File 'lib/aoc_cli/commands.rb', line 48 def exec Day::Init.new(u:user, y:year, d:day).mkdir. Day::Pages.new(u:user, y:year, d:day).load self end |
#respond ⇒ Object
57 58 59 |
# File 'lib/aoc_cli/commands.rb', line 57 def respond puts "Day #{day} initialised" end |