Class: AocCli::Commands::AttemptsTable

Inherits:
Object
  • Object
show all
Defined in:
lib/aoc_cli/commands.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ AttemptsTable

Returns a new instance of AttemptsTable.



148
149
150
151
152
153
154
# File 'lib/aoc_cli/commands.rb', line 148

def initialize(args)
  args = defaults.merge(args).compact
  @user = args[:user]
  @year = args[:year]
  @day  = args[:day]
  @part = args[:part]
end

Instance Attribute Details

#dayObject (readonly)

Returns the value of attribute day.



147
148
149
# File 'lib/aoc_cli/commands.rb', line 147

def day
  @day
end

#partObject (readonly)

Returns the value of attribute part.



147
148
149
# File 'lib/aoc_cli/commands.rb', line 147

def part
  @part
end

#userObject (readonly)

Returns the value of attribute user.



147
148
149
# File 'lib/aoc_cli/commands.rb', line 147

def user
  @user
end

#yearObject (readonly)

Returns the value of attribute year.



147
148
149
# File 'lib/aoc_cli/commands.rb', line 147

def year
  @year
end

Instance Method Details

#defaultsObject



159
160
161
162
163
164
# File 'lib/aoc_cli/commands.rb', line 159

def defaults
  {user:Metafile.get(:user),
   year:Metafile.get(:year),
    day:Metafile.get(:day),
   part:Metafile.get(:part)}
end

#execObject



155
156
157
158
# File 'lib/aoc_cli/commands.rb', line 155

def exec
  Tables::Attempts.new(u:user, y:year, d:day, p:part).print
  self
end