lib/tfa/storage.rb in tfa-0.0.14 vs lib/tfa/storage.rb in tfa-0.0.15
- old
+ new
@@ -1,10 +1,17 @@
module TFA
class Storage
include Enumerable
+ attr_reader :path
- def initialize(options)
- @storage = PStore.new(File.join(Dir.home, ".#{options[:filename]}.pstore"))
+ def initialize(path)
+ @path = path
+ @storage =
+ if ".pstore" == File.extname(path)
+ PStore.new(path)
+ else
+ YAML::Store.new(path)
+ end
end
def each
all.each do |each|
yield each