lib/secretfile.rb in secretfile-1.0.1 vs lib/secretfile.rb in secretfile-1.0.2
- old
+ new
@@ -11,22 +11,27 @@
instance.get k
end
def group
begin
- instance.group ||= {}
+ instance.mutex.synchronize do
+ raise "Can't nest Secretfile.group" if instance.group
+ instance.group = {}
+ end
yield
ensure
instance.group = nil
end
end
end
attr_reader :spec
+ attr_reader :mutex
attr_accessor :group
def initialize
super # singleton magic i guess
+ @mutex = Mutex.new
read_spec
end
def get(k)
k = k&.to_s