Sha256: 7326bc5ecbf64165b890932556056efe5ed239f9d4e9aca0cb7cefedffa550e9

Contents?: true

Size: 557 Bytes

Versions: 19

Compression:

Stored size: 557 Bytes

Contents

require 'rufus-scheduler'
class Maid::Repeat
  include Maid::RuleContainer
  
  attr_reader :timestring, :scheduler, :logger
  
  def initialize(maid, timestring, &rules)
    @maid = maid
    @logger = maid.logger # TODO: Maybe it's better to create seperate loggers?
    @scheduler = Rufus::Scheduler.singleton
    @timestring = timestring
    initialize_rules(&rules)
  end

  def run
    unless rules.empty?
      @scheduler.repeat(timestring) { follow_rules }
    end
  end
  
  def stop
    @scheduler.shutdown(:join) # Join the work threads
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
maid-0.8.0.alpha.4 lib/maid/repeat.rb
maid-0.8.0.alpha.3 lib/maid/repeat.rb
maid-0.8.0.alpha.2 lib/maid/repeat.rb
maid-0.8.0.alpha.1 lib/maid/repeat.rb
maid-0.7.0 lib/maid/repeat.rb
maid-0.7.0.beta.1 lib/maid/repeat.rb
maid-0.7.0.alpha.4 lib/maid/repeat.rb
maid-0.7.0.alpha.2 lib/maid/repeat.rb
maid-0.7.0.alpha.1 lib/maid/repeat.rb
maid-0.6.1 lib/maid/repeat.rb
maid-0.6.1.alpha.1 lib/maid/repeat.rb
maid-0.6.0 lib/maid/repeat.rb
maid-0.6.0.beta.2 lib/maid/repeat.rb
maid-0.6.0.beta.1 lib/maid/repeat.rb
maid-0.6.0.alpha.6 lib/maid/repeat.rb
maid-0.6.0.alpha.5 lib/maid/repeat.rb
maid-0.6.0.alpha.4 lib/maid/repeat.rb
maid-0.6.0.alpha.3 lib/maid/repeat.rb
maid-0.6.0.alpha.2 lib/maid/repeat.rb