Module: App

Extended by:
App, Root
Included in:
App
Defined in:
lib/app/app/cache.rb,
lib/app/app.rb,
lib/app/app/root.rb,
lib/app/app/config.rb,
lib/app/app/logger.rb

Overview

This is a cache module, which keeps entries for a certain time period, stored away in a redis store.

Entries are packed via Marshal.

Defined Under Namespace

Modules: Cache, Config, Root

Constant Summary collapse

INTENDATIONS =
{
  "DEBUG" => '        ',
  "INFO"  => '      **',
  "WARN"  => '    ****',
  "ERROR" => '  ******',
  "FATAL" => '********'
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Root

find, find_starting_in, is_root?, root, root=

Instance Attribute Details

#envObject

Returns the value of attribute env.



4
5
6
# File 'lib/app/app.rb', line 4

def env
  @env
end

Class Method Details

.loggerObject



4
5
6
# File 'lib/app/app/logger.rb', line 4

def self.logger
  @logger
end

.logger=(logger) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/app/app/logger.rb', line 16

def self.logger=(logger)
  logger.formatter = proc do |severity, datetime, progname, msg| 
    intend = INTENDATIONS[severity] || INTENDATIONS["FATAL"]
    "#{intend} #{msg}\n" 
  end

  @logger = logger
end

Instance Method Details

#cached(key, max_age = Cache::DEFAULT_MAX_AGE, &block) ⇒ Object



92
93
94
# File 'lib/app/app/cache.rb', line 92

def cached(key, max_age = Cache::DEFAULT_MAX_AGE, &block)
  Cache.cached(key, max_age, &block)
end

#configObject



55
56
57
# File 'lib/app/app/config.rb', line 55

def config
  Config.current
end