Class: Filtering::OnlyDirectory

Inherits:
Filter
  • Object
show all
Defined in:
lib/file_filter.rb

Instance Attribute Summary

Attributes inherited from Filter

#predicates

Instance Method Summary collapse

Methods inherited from Filter

#apply, #chain, #filter

Constructor Details

#initialize(subdirectory) ⇒ OnlyDirectory

Returns a new instance of OnlyDirectory.



44
45
46
47
48
49
50
51
# File 'lib/file_filter.rb', line 44

def initialize subdirectory
  base = Pathname.new(subdirectory).expand_path.to_s
  @predicates = []
  @predicates << proc do |path|
    file = Pathname.new(path).expand_path.to_s
    file.start_with? base
  end
end