Module: Reducer
- Defined in:
- lib/reducer.rb
Overview
Copyright © 2009 Matteo Sasso
This file is part of durb.
durb is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
durb is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with durb. If not, see <www.gnu.org/licenses/>.
Class Method Summary collapse
Class Method Details
.run(tree, threshold) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/reducer.rb', line 19 def self.run(tree, threshold) rtree = DirectoryNode.new(tree.path, tree.size, tree.files, tree.flags) tree.subdirectories.each{|n| rtree.add_subdirectory(run(n, threshold))} rtree.big = ((rtree.size + rtree.i_subsize) >= threshold) rtree.show = (rtree.big or not rtree.shown_subdirs.empty?) return rtree end |