Module: Sequel::Unicache::GlobalConfiguration::ClassMethods
- Included in:
- Sequel::Unicache
- Defined in:
- lib/sequel/unicache/global_configuration.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Class Method Summary collapse
Instance Method Summary collapse
- #configure(opts) ⇒ Object
- #disable ⇒ Object
- #enable ⇒ Object
- #enabled? ⇒ Boolean
- #suspend_unicache ⇒ Object
- #unicache_suspended? ⇒ Boolean
- #unsuspend_unicache ⇒ Object
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
36 37 38 |
# File 'lib/sequel/unicache/global_configuration.rb', line 36 def config @config end |
Class Method Details
.extended(base) ⇒ Object
38 39 40 |
# File 'lib/sequel/unicache/global_configuration.rb', line 38 def self.extended base base.instance_exec { @config = GlobalConfiguration.new } end |
Instance Method Details
#configure(opts) ⇒ Object
42 43 44 |
# File 'lib/sequel/unicache/global_configuration.rb', line 42 def configure opts @config.set opts end |
#disable ⇒ Object
50 51 52 |
# File 'lib/sequel/unicache/global_configuration.rb', line 50 def disable @disabled = true end |
#enable ⇒ Object
46 47 48 |
# File 'lib/sequel/unicache/global_configuration.rb', line 46 def enable @disabled = false end |
#enabled? ⇒ Boolean
54 55 56 |
# File 'lib/sequel/unicache/global_configuration.rb', line 54 def enabled? !@disabled end |
#suspend_unicache ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/sequel/unicache/global_configuration.rb', line 62 def suspend_unicache if block_given? origin, Thread.current[:unicache_suspended] = Thread.current[:unicache_suspended], true yield else origin = true end ensure Thread.current[:unicache_suspended] = origin end |
#unicache_suspended? ⇒ Boolean
58 59 60 |
# File 'lib/sequel/unicache/global_configuration.rb', line 58 def unicache_suspended? Thread.current[:unicache_suspended] end |
#unsuspend_unicache ⇒ Object
73 74 75 |
# File 'lib/sequel/unicache/global_configuration.rb', line 73 def unsuspend_unicache Thread.current[:unicache_suspended] = false end |