Class: ActiveTracker::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/active_tracker/configuration.rb

Defined Under Namespace

Classes: PluginInvalidError

Class Method Summary collapse

Class Method Details

.authentication(&block) ⇒ Object



54
55
56
57
58
59
# File 'lib/active_tracker/configuration.rb', line 54

def self.authentication(&block)
  if block
    @@authentication = block
  end
  @@authentication ||= nil
end

.authentication=(value) ⇒ Object



61
62
63
# File 'lib/active_tracker/configuration.rb', line 61

def self.authentication=(value)
  @@authentication = value
end

.mountpointObject



33
34
35
# File 'lib/active_tracker/configuration.rb', line 33

def self.mountpoint
  @@mountpoint ||= "activetracker"
end

.mountpoint=(path) ⇒ Object



41
42
43
# File 'lib/active_tracker/configuration.rb', line 41

def self.mountpoint=(path)
  @@mountpoint = path
end

.per_pageObject



49
50
51
52
# File 'lib/active_tracker/configuration.rb', line 49

def self.per_page
  @@per_page ||= 20
  @@per_page.to_i
end

.per_page=(value) ⇒ Object



45
46
47
# File 'lib/active_tracker/configuration.rb', line 45

def self.per_page=(value)
  @@per_page = value
end

.pluginsObject



3
4
5
6
7
8
# File 'lib/active_tracker/configuration.rb', line 3

def self.plugins
  @@plugins ||= [
    ActiveTracker::Plugin::Request,
  ]
  @@plugins
end

.plugins=(items) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/active_tracker/configuration.rb', line 10

def self.plugins=(items)
  items.each do |i|
    if i.respond_to?(:register)
      i.register
    else
      raise PluginInvalidError.new("#{i.name} doesn't correctly implement the ActiveTracker API")
    end
  end

  @@plugins = items.dup
end

.redis_urlObject



22
23
24
# File 'lib/active_tracker/configuration.rb', line 22

def self.redis_url
  @@redis_url ||= "redis://localhost:6379/15"
end

.redis_url=(url) ⇒ Object



26
27
28
29
30
31
# File 'lib/active_tracker/configuration.rb', line 26

def self.redis_url=(url)
  unless url.start_with?("redis://")
    raise PluginInvalidError.new("redis_url isn't a valid Redis URL - should begin with redis://")
  end
  @@redis_url = url
end

.root_pathObject



37
38
39
# File 'lib/active_tracker/configuration.rb', line 37

def self.root_path
  "/#{mountpoint}"
end