Class: AocCli::Day::Init

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

Direct Known Subclasses

Pages, Requests::Request

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(u: Metafile.get(:user), y: Metafile.get(:year), d: Metafile.get(:day)) ⇒ Init

Returns a new instance of Init.



5
6
7
8
9
10
11
12
# File 'lib/aoc_cli/day.rb', line 5

def initialize(u:Metafile.get(:user), 
			   y:Metafile.get(:year), 
			   d:Metafile.get(:day))
	@user  = Validate.user(u)
	@year  = Validate.year(y)
	@day   = Validate.day(d)
	@paths = Paths::Day.new(u:user, y:year, d:day)
end

Instance Attribute Details

#dayObject (readonly)

Returns the value of attribute day.



4
5
6
# File 'lib/aoc_cli/day.rb', line 4

def day
  @day
end

#pathsObject (readonly)

Returns the value of attribute paths.



4
5
6
# File 'lib/aoc_cli/day.rb', line 4

def paths
  @paths
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/aoc_cli/day.rb', line 4

def user
  @user
end

#yearObject (readonly)

Returns the value of attribute year.



4
5
6
# File 'lib/aoc_cli/day.rb', line 4

def year
  @year
end

Instance Method Details

#metaObject



17
18
19
20
21
# File 'lib/aoc_cli/day.rb', line 17

def meta
	File.write(paths.local(f:"meta"), 
		Metafile.day(u:user, y:year, d:day))
	self
end

#mkdirObject



13
14
15
16
# File 'lib/aoc_cli/day.rb', line 13

def mkdir
	Dir.mkdir(Validate.day_dir(paths.day_dir))
	self
end