Something went wrong. Try again.
Code for the Advent of Code event
aoc advent-of-code
Something went wrong. Try again.
599 B · 27 lines
Ruby
at rust
12345678910111213141516171819202122232425262728# frozen_string_literal: true
require 'tomlib'
module AoC # Config utilities. class Config # Session token for accessing AoC website. # @return [String] attr_reader :session
# Creates a new config instance. # @param options [Hash] Hash containing the options to use. def initialize(**options) @session = options.dig('api', 'session') end
# Loads a new config instance from file. # @param path [String] # @return [Config] def self.load(path) data = File.read path options = Tomlib.load data new(**options) end endend