Class: AocCli::Commands::YearInit
- Inherits:
-
Object
- Object
- AocCli::Commands::YearInit
- Defined in:
- lib/aoc_cli/commands.rb
Instance Attribute Summary collapse
-
#git ⇒ Object
readonly
Returns the value of attribute git.
-
#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) ⇒ YearInit
constructor
A new instance of YearInit.
- #respond ⇒ Object
Constructor Details
#initialize(args) ⇒ YearInit
Returns a new instance of YearInit.
22 23 24 25 |
# File 'lib/aoc_cli/commands.rb', line 22 def initialize(args) args = defaults.merge(args).compact @user, @year, @git = args[:user], args[:year], args[:git] end |
Instance Attribute Details
#git ⇒ Object (readonly)
Returns the value of attribute git.
21 22 23 |
# File 'lib/aoc_cli/commands.rb', line 21 def git @git end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
21 22 23 |
# File 'lib/aoc_cli/commands.rb', line 21 def user @user end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
21 22 23 |
# File 'lib/aoc_cli/commands.rb', line 21 def year @year end |
Instance Method Details
#defaults ⇒ Object
35 36 37 38 |
# File 'lib/aoc_cli/commands.rb', line 35 def defaults { user:Prefs.default_alias, git:Prefs.bool(key:"init_git") } end |
#exec ⇒ Object
26 27 28 29 30 31 |
# File 'lib/aoc_cli/commands.rb', line 26 def exec Year::Meta.new(u:user, y:year).write Year::Progress.new(u:user, y:year).write.init_calendar_db Year::GitWrap.new if git self end |
#respond ⇒ Object
32 33 34 |
# File 'lib/aoc_cli/commands.rb', line 32 def respond puts "Year #{year} initialised" end |