Class: CleanupVendor::Path
- Inherits:
-
Pathname
- Object
- Pathname
- CleanupVendor::Path
- Defined in:
- lib/cleanup_vendor/path.rb
Instance Method Summary collapse
- #gem_level? ⇒ Boolean
- #include?(enum) ⇒ Boolean
- #match?(patterns) ⇒ Boolean
- #recursive_entries ⇒ Object
- #summary ⇒ Object
Instance Method Details
#gem_level? ⇒ Boolean
23 24 25 |
# File 'lib/cleanup_vendor/path.rb', line 23 def gem_level? @gem_level ||= parent.glob('*.gemspec').any? end |
#include?(enum) ⇒ Boolean
27 28 29 |
# File 'lib/cleanup_vendor/path.rb', line 27 def include?(enum) descend.any? { |p| enum.include?(p) } end |
#match?(patterns) ⇒ Boolean
15 16 17 18 19 20 21 |
# File 'lib/cleanup_vendor/path.rb', line 15 def match?(patterns) patterns.any? do |p| p.eql?(self) || p.start_with?('**') && fnmatch?(p, File::FNM_EXTGLOB) || basename.fnmatch?(p, File::FNM_EXTGLOB) && gem_level? end end |
#recursive_entries ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/cleanup_vendor/path.rb', line 7 def recursive_entries return to_enum(:recursive_entries) unless block_given? glob('**/*', File::FNM_DOTMATCH) do |path| yield(Path.new(path)) unless path == self end end |
#summary ⇒ Object
31 32 33 34 |
# File 'lib/cleanup_vendor/path.rb', line 31 def summary entries = [self] + recursive_entries.to_a entries.map(&:stat) end |