Module: Capacitor
- Defined in:
- lib/capacitor.rb,
lib/capacitor/cli.rb,
lib/capacitor/railtie.rb,
lib/capacitor/updater.rb,
lib/capacitor/version.rb,
lib/capacitor/watcher.rb,
lib/capacitor/counter_cache.rb,
lib/capacitor/commands_fetcher.rb
Defined Under Namespace
Classes: CLI, CommandsFetcher, CounterCache, Railtie, Updater, Watcher
Constant Summary
collapse
- VERSION =
"1.0.0"
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.logger ⇒ Object
15
16
17
|
# File 'lib/capacitor.rb', line 15
def logger
@logger ||= const_defined?(:Rails) ? Rails.logger : Logger.new(STDOUT)
end
|
Class Method Details
.log_level=(level) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/capacitor.rb', line 19
def log_level=(level)
return unless level
begin
level = Logger.const_get level.upcase if level.is_a?(String)
logger.level = level
rescue Exception => e
logger.error "Unable to set log level to #{level} - #{e}"
end
end
|
.redis ⇒ Object
33
34
35
|
# File 'lib/capacitor.rb', line 33
def redis
@redis ||= Redis::Namespace.new :capacitor, redis: Redis.current
end
|
.redis=(redis) ⇒ Object
29
30
31
|
# File 'lib/capacitor.rb', line 29
def redis=(redis)
@redis = Redis::Namespace.new :capacitor, redis: redis
end
|
.run ⇒ Object
37
38
39
40
|
# File 'lib/capacitor.rb', line 37
def run
STDOUT.sync = true
Watcher.run
end
|