class FluxTuna::Witness::DirFileWitness

Create a Witness object for the specified directory

Public Class Methods

new() click to toggle source

Default constructor

Calls superclass method FluxTuna::Witness::AbstractWitness::new
# File lib/witness/dir_file_witness.rb, line 24
def initialize
  super(:Dir, :Null, :Tree)
  
  @content = FluxTuna::Core::NameTrie.new
end

Public Instance Methods

shatter(path) click to toggle source

Run the shatter function, taking path is the {File.glob} shell glob for the path and pattern to match when looking for files

# File lib/witness/dir_file_witness.rb, line 33
def shatter(path)
  
  # Walk the path,
  Dir.glob(path){|file_name|
    
    # Ignore directories
    unless File.directory?(file_name) then
      
      # Ignore the special files as well
      unless file_name == "." or file_name == ".." then
        
        # Create a GUID, then add this filename as the descriptor
        @content[UUIDTools::UUID.random_create] = file_name
      end        
    end
    
  }
  
end