Class: FSSM::State::File

### Home Classes Methods

### In Files

- lib/fssm/state/file.rb

### Parent

Object

### Methods

- ::new
- #refresh

### 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::State::File

### Attributes

path[R]

### Public Class Methods

new(path) click to toggle source

    # File lib/fssm/state/file.rb, line 5
    def initialize(path)
      @path = path
    end

### Public Instance Methods

refresh(base=nil, skip_callbacks=false) click to toggle source

    # File lib/fssm/state/file.rb, line 9
    def refresh(base=nil, skip_callbacks=false)
      base ||= @path.to_pathname
      used_to_exist, @exists = @exists, base.exist?
      # this handles bad symlinks without failing. why handle bad symlinks at
      # all? well, we could still be interested in their creation and deletion.
      old_mtime, @mtime = @mtime, base.symlink? ? Time.at(0) : base.mtime if @exists

      unless skip_callbacks
        @path.delete(@path.to_s) if used_to_exist && !@exists
        @path.create(@path.to_s) if !used_to_exist && @exists
        @path.update(@path.to_s) if used_to_exist && @exists && old_mtime != @mtime
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.