Module: PathMapper::Node::Dir::Representation

Included in:
PathMapper::Node::Dir
Defined in:
lib/path_mapper/node/dir/representation.rb

Instance Method Summary collapse

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
14
# File 'lib/path_mapper/node/dir/representation.rb', line 5

def empty?
  self.with_dry_run do |dry_run|
    if dry_run
      empty = self.storage.select {|k,v| k.to_s.start_with? @path.to_s }.count == 1
      @path.directory? ? (@path.children - self.deleted_files).empty? : empty
    else
      @path.children.empty?
    end
  end
end