Module: FSSM::Support

### Home Classes Methods

### In Files

- lib/fssm/support.rb

### Methods

- ::backend
- ::jruby?
- ::linux?
- ::lion?
- ::mac?
- ::optimal_backend_dependency
- ::rb_fsevent?
- ::rb_inotify?
- ::usable_backend
- ::use_block

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

### Public Class Methods

backend() click to toggle source

    # File lib/fssm/support.rb, line 24
    def backend
      @@backend ||= usable_backend
    end

jruby?() click to toggle source

    # File lib/fssm/support.rb, line 28
    def jruby?
      defined?(JRUBY_VERSION)
    end

linux?() click to toggle source

    # File lib/fssm/support.rb, line 40
    def linux?
      RbConfig::CONFIG['target_os'] =~ /linux/
    end

lion?() click to toggle source

    # File lib/fssm/support.rb, line 36
    def lion?
      RbConfig::CONFIG['target_os'] =~ /darwin11/
    end

mac?() click to toggle source

    # File lib/fssm/support.rb, line 32
    def mac?
      RbConfig::CONFIG['target_os'] =~ /darwin/
    end

optimal_backend_dependency() click to toggle source

    # File lib/fssm/support.rb, line 16
    def optimal_backend_dependency
      return case
        when mac?     then  ['rb-fsevent', '>= 0.4.3.1']
        when linux?   then  ['rb-inotify', '>= 0.8.8']
        else                [nil, nil]
      end
    end

rb_fsevent?() click to toggle source

    # File lib/fssm/support.rb, line 44
    def rb_fsevent?
      begin
        require 'rb-fsevent'
        defined?(FSEvent::VERSION) ? FSEvent::VERSION.to_f >= 0.4 : false
      rescue LoadError
        false
      end
    end

rb_inotify?() click to toggle source

    # File lib/fssm/support.rb, line 53
    def rb_inotify?
      begin
        require 'rb-inotify'
        if defined?(INotify::VERSION)
          version = INotify::VERSION
          version[0] > 0 || version[1] >= 6
        end
      rescue LoadError
        false
      end
    end

usable_backend() click to toggle source

    # File lib/fssm/support.rb, line 5
    def usable_backend
      case
        when mac? && rb_fsevent?
          'RBFSEvent'
        when linux? && rb_inotify?
          'Inotify'
        else
          'Polling'
      end
    end

use_block(context, block) click to toggle source

    # File lib/fssm/support.rb, line 65
    def use_block(context, block)
      return if block.nil?
      if block.arity == 1
        block.call(context)
      else
        context.instance_eval(&block)
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.