Class: FluxTuna::Witness::DirFileWitness
- Inherits:
-
AbstractWitness
- Object
- AbstractWitness
- FluxTuna::Witness::DirFileWitness
- Defined in:
- lib/witness/dir_file_witness.rb
Overview
Create a Witness object for the specified directory
Instance Method Summary collapse
-
#initialize ⇒ DirFileWitness
constructor
Default constructor.
-
#shatter(path) ⇒ Object
Run the shatter function, taking
path
is the File.glob shell glob for the path and pattern to match when looking for files.
Methods inherited from AbstractWitness
Constructor Details
#initialize ⇒ DirFileWitness
Default constructor
24 25 26 27 28 |
# File 'lib/witness/dir_file_witness.rb', line 24 def initialize super(:Dir, :Null, :Tree) @content = FluxTuna::Core::NameTrie.new end |
Instance Method Details
#shatter(path) ⇒ Object
Run the shatter function, taking path
is the File.glob shell glob for the path and pattern to match when looking for files
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# 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 |