class Roda::RodaPlugins::RecheckPrecompiledAssets::CompiledAssetsHash
Thread safe wrapper for the compiled asset metadata hash. Does not wrap all hash methods, only a few that are used.
Public Class Methods
Source
# File lib/roda/plugins/recheck_precompiled_assets.rb, line 21 def initialize @hash = {} @mutex = Mutex.new end
Public Instance Methods
Source
# File lib/roda/plugins/recheck_precompiled_assets.rb, line 26 def [](key) @mutex.synchronize{@hash[key]} end
Source
# File lib/roda/plugins/recheck_precompiled_assets.rb, line 30 def []=(key, value) @mutex.synchronize{@hash[key] = value} end
Source
# File lib/roda/plugins/recheck_precompiled_assets.rb, line 40 def each(&block) @mutex.synchronize{@hash.dup}.each(&block) self end
Source
# File lib/roda/plugins/recheck_precompiled_assets.rb, line 34 def replace(hash) hash = hash.instance_variable_get(:@hash) if (CompiledAssetsHash === hash) @mutex.synchronize{@hash.replace(hash)} self end
Source
# File lib/roda/plugins/recheck_precompiled_assets.rb, line 45 def to_json(*args) @mutex.synchronize{@hash.dup}.to_json(*args) end