Module: FSSM::Tree::NodeInsertion

### Home Classes Methods

### In Files

- lib/fssm/tree.rb

### Methods

- #descendant
- #descendant!
- #key_segments
- #recurse
- #set
- #unset

### Included Modules

- FSSM::Tree::NodeBase

### 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::Tree::NodeInsertion

### Public Instance Methods

set(path) click to toggle source

    # File lib/fssm/tree.rb, line 66
    def set(path)
      node = descendant!(path)
      node.from_path(path).mtime
    end

unset(path) click to toggle source

    # File lib/fssm/tree.rb, line 48
    def unset(path)
      key = key_segments(path)

      if key.empty?
        remove_children
        return nil
      end

      segment = key.pop
      node    = descendant(key)

      return unless node

      node.remove_child(segment)

      nil
    end

### Protected Instance Methods

descendant(path) click to toggle source

    # File lib/fssm/tree.rb, line 78
    def descendant(path)
      recurse(path, false)
    end

descendant!(path) click to toggle source

    # File lib/fssm/tree.rb, line 82
    def descendant!(path)
      recurse(path, true)
    end

key_segments(key) click to toggle source

    # File lib/fssm/tree.rb, line 73
    def key_segments(key)
      return key if key.is_a?(Array)
      FSSM::Pathname.for(key).segments
    end

recurse(key, create=false) click to toggle source

    # File lib/fssm/tree.rb, line 86
    def recurse(key, create=false)
      key  = key_segments(key)
      node = self

      until key.empty?
        segment = key.shift
        node    = create ? node.child!(segment) : node.child(segment)
        return nil unless node
      end

      node
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.