class Roda::RodaPlugins::RecheckPrecompiledAssets::CompiledAssetsHash

  1. lib/roda/plugins/recheck_precompiled_assets.rb
Superclass: Object

Thread safe wrapper for the compiled asset metadata hash. Does not wrap all hash methods, only a few that are used.

Methods

Public Class

  1. new

Public Instance

  1. []
  2. []=
  3. each
  4. replace
  5. to_json

Included modules

  1. Enumerable

Public Class methods

new()
[show source]
   # File lib/roda/plugins/recheck_precompiled_assets.rb
21 def initialize
22   @hash = {}
23   @mutex = Mutex.new
24 end

Public Instance methods

[](key)
[show source]
   # File lib/roda/plugins/recheck_precompiled_assets.rb
26 def [](key)
27   @mutex.synchronize{@hash[key]}
28 end
[]=(key, value)
[show source]
   # File lib/roda/plugins/recheck_precompiled_assets.rb
30 def []=(key, value)
31   @mutex.synchronize{@hash[key] = value}
32 end
each(&block)
[show source]
   # File lib/roda/plugins/recheck_precompiled_assets.rb
40 def each(&block)
41   @mutex.synchronize{@hash.dup}.each(&block)
42   self
43 end
replace(hash)
[show source]
   # File lib/roda/plugins/recheck_precompiled_assets.rb
34 def replace(hash)
35   hash = hash.instance_variable_get(:@hash) if (CompiledAssetsHash === hash)
36   @mutex.synchronize{@hash.replace(hash)}
37   self
38 end
to_json(*args)
[show source]
   # File lib/roda/plugins/recheck_precompiled_assets.rb
45 def to_json(*args)
46   @mutex.synchronize{@hash.dup}.to_json(*args)
47 end