Class: AocCli::Commands::StatsTable
- Inherits:
-
Object
- Object
- AocCli::Commands::StatsTable
- 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) ⇒ StatsTable
constructor
A new instance of StatsTable.
Constructor Details
#initialize(args) ⇒ StatsTable
168 169 170 171 172 173 |
# File 'lib/aoc_cli/commands.rb', line 168 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.
167 168 169 |
# File 'lib/aoc_cli/commands.rb', line 167 def day @day end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
167 168 169 |
# File 'lib/aoc_cli/commands.rb', line 167 def user @user end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
167 168 169 |
# File 'lib/aoc_cli/commands.rb', line 167 def year @year end |
Instance Method Details
#defaults ⇒ Object
179 180 181 182 183 |
# File 'lib/aoc_cli/commands.rb', line 179 def defaults { user:Metafile.get(:user), year:Metafile.get(:year), day:Metafile.get(:day) } end |
#exec ⇒ Object
174 175 176 177 178 |
# File 'lib/aoc_cli/commands.rb', line 174 def exec day.nil? ? Tables::Stats::Year.new(u:user, y:year).print : Tables::Stats::Day.new(u:user, y:year, d:day).print end |