Class: Lokii::Processor
- Inherits:
-
Object
- Object
- Lokii::Processor
- Defined in:
- lib/lokii/processor.rb
Class Method Summary collapse
- .daemon? ⇒ Boolean
- .handlers=(*args) ⇒ Object
- .hanlders ⇒ Object
- .process ⇒ Object
- .running? ⇒ Boolean
- .servers ⇒ Object
- .servers=(*args) ⇒ Object
- .stopped? ⇒ Boolean
Class Method Details
.daemon? ⇒ Boolean
51 52 53 |
# File 'lib/lokii/processor.rb', line 51 def self.daemon? defined?(LOKII_DAEMON) && LOKII_DAEMON end |
.handlers=(*args) ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/lokii/processor.rb', line 34 def self.handlers=(*args) arr = args.first if args.first.is_a?(Array) arr ||= args @handlers = arr self.servers.each { |server| server.handlers = @handlers } end |
.hanlders ⇒ Object
23 24 25 26 |
# File 'lib/lokii/processor.rb', line 23 def self.hanlders @hanlders ||= [] @handlers end |
.process ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lokii/processor.rb', line 3 def self.process # Make sure it is not stopped and that we started it return if self.stopped? return unless self.running? if Lokii::Config.verbose Lokii::Logger.debug "" Lokii::Logger.debug "Processing #{Time.now}" end catch :halt do self.servers.each {|server| server.process } end end |
.running? ⇒ Boolean
47 48 49 |
# File 'lib/lokii/processor.rb', line 47 def self.running? File.exist?(File.join(Lokii::Config.root, Lokii::Config.pid).gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)) end |
.servers ⇒ Object
18 19 20 21 |
# File 'lib/lokii/processor.rb', line 18 def self.servers @servers ||= [] @servers end |
.servers=(*args) ⇒ Object
28 29 30 31 32 |
# File 'lib/lokii/processor.rb', line 28 def self.servers=(*args) arr = args.first if args.first.is_a?(Array) arr ||= args @servers = arr end |
.stopped? ⇒ Boolean
43 44 45 |
# File 'lib/lokii/processor.rb', line 43 def self.stopped? defined?(@@stopped) && @@stopped end |