Class: Remon::ProcCheck

Inherits:
Check
  • Object
show all
Defined in:
lib/remon/proc_check.rb

Constant Summary

Constants inherited from Check

Check::CRITICAL, Check::OK, Check::WARNING

Instance Attribute Summary collapse

Attributes inherited from Check

#mutex, #opts

Instance Method Summary collapse

Methods inherited from Check

get_opts, name, name=, opts, #run_mutex

Methods included from Logger

logger, #logger

Constructor Details

#initialize(name, pr) ⇒ ProcCheck

Returns a new instance of ProcCheck.



6
7
8
9
10
11
# File 'lib/remon/proc_check.rb', line 6

def initialize(name, pr)
  raise "no proc passed" if not pr.is_a?(Proc)
  @name = name
  @pr = pr
  @mutex = Mutex.new
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/remon/proc_check.rb', line 5

def name
  @name
end

Instance Method Details

#check_nameObject



17
18
19
# File 'lib/remon/proc_check.rb', line 17

def check_name
  @name
end

#runObject



13
14
15
# File 'lib/remon/proc_check.rb', line 13

def run
  instance_eval &@pr
end

#to_sObject



21
22
23
# File 'lib/remon/proc_check.rb', line 21

def to_s
  "<proc:#{@name}>"
end