summaryrefslogtreecommitdiff
path: root/lib/config.rb
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-12-06 23:52:43 +0200
committerPaul Buetow <paul@buetow.org>2024-12-06 23:52:43 +0200
commit7c23b27007ca62ff545411aa3d1200fce4eec8c9 (patch)
tree86e4215580368b5c6f164bb79c2a0f91f479c7f1 /lib/config.rb
parent36c00a4509e745e4b29b1194faca4dca830a9b95 (diff)
refactor
Diffstat (limited to 'lib/config.rb')
-rw-r--r--lib/config.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/config.rb b/lib/config.rb
new file mode 100644
index 0000000..b9dc5ac
--- /dev/null
+++ b/lib/config.rb
@@ -0,0 +1,18 @@
+require 'toml'
+
+module RCM
+ # Configuration
+ module Config
+ @@config = File.exist?('config.toml') ? TOML.load_file('config.toml') : {}
+
+ def config(key)
+ raise "No such config key: #{key}" unless @@config.key?(key)
+
+ @@config[key]
+ end
+
+ def dump_config
+ p @@config
+ end
+ end
+end