Class: FSSM::Backends::RBFSEvent

### Home Classes Methods

### In Files

- lib/fssm/backends/rbfsevent.rb

### Parent

Object

### Methods

- ::new
- #add_handler
- #run
- #temporary_multipath_hack
- #temporary_multipath_handler

### 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::RBFSEvent

### Public Class Methods

new() click to toggle source

    # File lib/fssm/backends/rbfsevent.rb, line 3
    def initialize
      @handlers = []
    end

### Public Instance Methods

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

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

run() click to toggle source

    # File lib/fssm/backends/rbfsevent.rb, line 12
    def run
      begin
        @fsevent = FSEvent.new
        @fsevent.watch(temporary_multipath_hack) do |paths|
          paths.each do |path|
            temporary_multipath_handler(path)
          end
        end
        @fsevent.run
      rescue Interrupt
        @fsevent.stop
      end
    end

temporary_multipath_hack() click to toggle source

    # File lib/fssm/backends/rbfsevent.rb, line 36
    def temporary_multipath_hack
      @handlers = @handlers.sort {|x,y| y.path.to_pathname.segments.length <=> x.path.to_pathname.segments.length}
      return @handlers.map {|handler| handler.path.to_s}
    end

temporary_multipath_handler(path) click to toggle source

    # File lib/fssm/backends/rbfsevent.rb, line 26
    def temporary_multipath_handler(path)
      @handlers.each do |handler|
        handler_path = File.join(handler.path.to_s, "")
        if path.start_with?(handler_path)
          handler.refresh(path)
          break
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.