Class: AocCli::Commands::PrintCal

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ PrintCal

Returns a new instance of PrintCal.



202
203
204
205
# File 'lib/aoc_cli/commands.rb', line 202

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

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



201
202
203
# File 'lib/aoc_cli/commands.rb', line 201

def path
  @path
end

#yearObject (readonly)

Returns the value of attribute year.



201
202
203
# File 'lib/aoc_cli/commands.rb', line 201

def year
  @year
end

Instance Method Details

#defaultsObject



217
218
219
# File 'lib/aoc_cli/commands.rb', line 217

def defaults
	{year:Metafile.get(:year)}
end

#execObject



212
213
214
215
216
# File 'lib/aoc_cli/commands.rb', line 212

def exec
	Prefs.bool(key:"calendar_file") ?
		system("cat #{path} | less") :
		puts("You have disabled calendar files")
end