Module: Sequel::Unicache::GlobalConfiguration::ClassMethods

Included in:
Sequel::Unicache
Defined in:
lib/sequel/unicache/global_configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject (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

#disableObject



50
51
52
# File 'lib/sequel/unicache/global_configuration.rb', line 50

def disable
  @disabled = true
end

#enableObject



46
47
48
# File 'lib/sequel/unicache/global_configuration.rb', line 46

def enable
  @disabled = false
end

#enabled?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/sequel/unicache/global_configuration.rb', line 54

def enabled?
  !@disabled
end

#suspend_unicacheObject



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

Returns:

  • (Boolean)


58
59
60
# File 'lib/sequel/unicache/global_configuration.rb', line 58

def unicache_suspended?
  Thread.current[:unicache_suspended]
end

#unsuspend_unicacheObject



73
74
75
# File 'lib/sequel/unicache/global_configuration.rb', line 73

def unsuspend_unicache
  Thread.current[:unicache_suspended] = false
end