Class: FSSM::Backends::Polling

### Home Classes Methods

### In Files

- lib/fssm/backends/polling.rb

### Parent

Object

### Methods

- ::new
- #add_handler
- #run

### Class/Module Index

Quicksearch

- FSSM
- FSSM::Backends
- FSSM::Backends::Inotify
- FSSM::Backends::Polling
- FSSM::Backends::RBFSEvent
- FSSM::Monitor
- FSSM::Path
- FSSM::Pathname
- FSSM::State
- FSSM::State::Directory
- FSSM::State::File
- FSSM::Support
- FSSM::Tree
- FSSM::Tree::Cache
- FSSM::Tree::CacheDebug
- FSSM::Tree::Node
- FSSM::Tree::NodeBase
- FSSM::Tree::NodeEnumerable
- FSSM::Tree::NodeInsertion

No matching classes.

# FSSM::Backends::Polling

### Public Class Methods

new(options={}) click to toggle source

    # File lib/fssm/backends/polling.rb, line 3
    def initialize(options={})
      @handlers = []
      @latency  = options[:latency] || 1.5
    end

### Public Instance Methods

add_handler(handler, preload=true) click to toggle source

    # File lib/fssm/backends/polling.rb, line 8
    def add_handler(handler, preload=true)
      handler.refresh(nil, true) if preload
      @handlers << handler
    end

run() click to toggle source

    # File lib/fssm/backends/polling.rb, line 13
    def run
      begin
        loop do
          start = Time.now.to_f
          @handlers.each { |handler| handler.refresh }
          nap_time = @latency - (Time.now.to_f - start)
          sleep nap_time if nap_time > 0
        end
      rescue Interrupt
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.