Class: AocCli::Commands::DaySolve

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ DaySolve

Returns a new instance of DaySolve.



63
64
65
66
67
68
69
70
# File 'lib/aoc_cli/commands.rb', line 63

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

Instance Attribute Details

#ansObject (readonly)

Returns the value of attribute ans.



62
63
64
# File 'lib/aoc_cli/commands.rb', line 62

def ans
  @ans
end

#dayObject (readonly)

Returns the value of attribute day.



62
63
64
# File 'lib/aoc_cli/commands.rb', line 62

def day
  @day
end

#partObject (readonly)

Returns the value of attribute part.



62
63
64
# File 'lib/aoc_cli/commands.rb', line 62

def part
  @part
end

#userObject (readonly)

Returns the value of attribute user.



62
63
64
# File 'lib/aoc_cli/commands.rb', line 62

def user
  @user
end

#yearObject (readonly)

Returns the value of attribute year.



62
63
64
# File 'lib/aoc_cli/commands.rb', line 62

def year
  @year
end

Instance Method Details

#defaultsObject



77
78
79
80
81
82
# File 'lib/aoc_cli/commands.rb', line 77

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

#execObject



71
72
73
74
75
76
# File 'lib/aoc_cli/commands.rb', line 71

def exec 
  Solve::Attempt
    .new(u:user, y:year, d:day, p:part, a:ans)
    .respond
  self
end