module Donjon::User::ClassMethods
Public Instance Methods
each(repo, &block)
click to toggle source
# File lib/donjon/user.rb, line 44 def each(repo, &block) container = repo.join('users') return unless container.exist? container.children.each do |child| next unless child.extname == '.pub' name = child.basename.to_s.chomp('.pub') key = OpenSSL::PKey::RSA.new(child.read) block.call new(name: name, key: key, repo: repo) end end
find(name:, repo:)
click to toggle source
# File lib/donjon/user.rb, line 37 def find(name:, repo:) path = _path_for(name, repo) return unless path.exist? key = OpenSSL::PKey::RSA.new(path.read) new(name: name, key: key, repo: repo) end