Class: Dir
- Inherits:
-
Object
- Object
- Dir
- Defined in:
- lib/taglob/extensions/dir.rb
Class Method Summary collapse
- .tag_and(pattern, *tags) ⇒ Object
- .tag_or(pattern, *tags) ⇒ Object
- .taglob(pattern, tags) ⇒ Object
- .tags(pattern) ⇒ Object
Class Method Details
.tag_and(pattern, *tags) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/taglob/extensions/dir.rb', line 18 def self.tag_and(pattern, *) tagged_files = [] self.(pattern).each do |file,| tagged_files << file if ( - ).empty? end tagged_files end |
.tag_or(pattern, *tags) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/taglob/extensions/dir.rb', line 26 def self.tag_or(pattern, *) tagged_files = [] self.(pattern).each do |file,| tagged_files << file if !( & ).empty? end tagged_files end |
.taglob(pattern, tags) ⇒ Object
12 13 14 15 16 |
# File 'lib/taglob/extensions/dir.rb', line 12 def self.taglob(pattern,) return glob(pattern) if .nil? return Dir.tag_or(pattern,*.split('|')) if .include?('|') Dir.tag_and(pattern,*.split(',')) end |
.tags(pattern) ⇒ Object
3 4 5 6 7 8 9 10 |
# File 'lib/taglob/extensions/dir.rb', line 3 def self.(pattern) files = {} Dir.glob(pattern).each do |file| = File.(file) files.merge!({file => }) unless .empty? end files end |