summaryrefslogtreecommitdiff
path: root/bin/common.rb
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 15:56:55 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 15:56:55 -0400
commit6a91ec075c8a89559c0957c096a99b96b4a58ca1 (patch)
treeaa77e38ea24b2f043f86c24af5403c8fe6bf78d7 /bin/common.rb
parenta99143e86220f93afb6ba93c6ac7b4ef65dc2920 (diff)
common.rb#load_all_users: return a map of uid=>info, instead of an array of infos
Diffstat (limited to 'bin/common.rb')
-rw-r--r--bin/common.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/bin/common.rb b/bin/common.rb
index a5840ec..4380340 100644
--- a/bin/common.rb
+++ b/bin/common.rb
@@ -12,5 +12,11 @@ def load_user_yaml(filename)
end
def load_all_users
- Dir.glob("#{cfg["yamldir"]}/*.yml").map{|filename|load_user_yaml(filename)}
+ users = {}
+ Dir.glob("#{cfg["yamldir"]}/*.yml").map{|filename|
+ uid = File.basename(filename).sub(/^([0-9]*)\.yml$/, "\\1").to_i
+ user = load_user_yaml(filename)
+ users[uid] = user
+ }
+ return users
end