Class: Gearman::Util
- Inherits:
-
Object
- Object
- Gearman::Util
- Defined in:
- lib/gearman/util.rb
Overview
Util
Description
Static helper methods and data used by other classes.
Constant Summary collapse
- @@debug =
false
Class Method Summary collapse
- .ability_name_with_prefix(prefix, name) ⇒ Object (also: ability_name_for_perl)
-
.debug=(v) ⇒ Object
Enable or disable debugging output (off by default).
-
.err(str) ⇒ Object
Log a message no matter what.
-
.log(str, force = false) ⇒ Object
Log a message if debugging is enabled.
Class Method Details
.ability_name_with_prefix(prefix, name) ⇒ Object Also known as: ability_name_for_perl
42 43 44 |
# File 'lib/gearman/util.rb', line 42 def Util.ability_name_with_prefix(prefix,name) "#{prefix}\t#{name}" end |
.debug=(v) ⇒ Object
Enable or disable debugging output (off by default).
22 23 24 |
# File 'lib/gearman/util.rb', line 22 def Util.debug=(v) @@debug = v end |
.err(str) ⇒ Object
Log a message no matter what.
38 39 40 |
# File 'lib/gearman/util.rb', line 38 def Util.err(str) log(str, true) end |
.log(str, force = false) ⇒ Object
Log a message if debugging is enabled.
30 31 32 |
# File 'lib/gearman/util.rb', line 30 def Util.log(str, force=false) puts "#{Time.now.strftime '%Y-%m-%d %H:%M:%S'} #{str}" if force or @@debug end |