Sha256: de858c22a9491c963f629c0331c3ec441640bcd65fb4cc7d57f08d0ddf3c9c72
Contents?: true
Size: 791 Bytes
Versions: 3
Compression:
Stored size: 791 Bytes
Contents
module TFA class Storage include Enumerable def initialize(options) @storage = PStore.new(File.join(Dir.home, ".#{options[:filename]}.pstore")) end def each all.each do |each| yield each end end def all open_readonly do |storage| storage.roots.map { |key| { key => storage[key] } } end end def secret_for(key) open_readonly do |storage| storage[key] end end def save(key, value) @storage.transaction do @storage[key] = value end end def delete(key) @storage.transaction do @storage.delete(key) end end private def open_readonly @storage.transaction(true) do yield @storage end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tfa-0.0.14 | lib/tfa/storage.rb |
tfa-0.0.13 | lib/tfa/storage.rb |
tfa-0.0.12 | lib/tfa/storage.rb |