Module: Pgmonitor

Defined in:
lib/pgmonitor.rb,
lib/pgmonitor/version.rb

Defined Under Namespace

Modules: PS, UsageData

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.debug?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/pgmonitor.rb', line 12

def self.debug?
  settings[:debug] == true
end

.delayObject



16
17
18
# File 'lib/pgmonitor.rb', line 16

def self.delay
  settings[:delay] || 2
end

.log_itemsObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/pgmonitor.rb', line 20

def self.log_items
  return "" unless settings[:log_items]

  @@log_items ||= if settings[:log_items].kind_of?(Hash)
    " " + settings[:log_items].map { |k,v| "#{k}=#{v}" }.join(" ")
  elsif settings[:log_items].kind_of?(Array)
    " " + settings[:log_items].join(" ")
  else
    " #{settings[:log_items]}"
  end
end

.settingsObject



8
9
10
# File 'lib/pgmonitor.rb', line 8

def self.settings
  @@settings ||= {}
end

.settings=(opts) ⇒ Object



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

def self.settings=(opts)
  @@settings = opts
end