Module: Sparrowhawk::FileEntryMapper
- Includes:
- Enumerable
- Included in:
- ApplicationFilesMapper, PublicDirMapper
- Defined in:
- lib/sparrowhawk/file_entry_mapper.rb
Instance Method Summary (collapse)
- - (Object) each
- - (Boolean) excluded?(file_path)
- - (Object) excluded_path_patterns
- - (Object) expand_path(file_name)
- - (Object) file_entry_tuples
Instance Method Details
- (Object) each
5 6 7 8 9 10 11 |
# File 'lib/sparrowhawk/file_entry_mapper.rb', line 5 def each file_entry_tuples.each do |entry_name, file_path| next if File.directory? file_path next if excluded? file_path yield FileEntry.new entry_name, file_path end end |
- (Boolean) excluded?(file_path)
23 24 25 |
# File 'lib/sparrowhawk/file_entry_mapper.rb', line 23 def excluded? file_path excluded_path_patterns.any? { |pattern| pattern =~ file_path } end |
- (Object) excluded_path_patterns
27 28 29 |
# File 'lib/sparrowhawk/file_entry_mapper.rb', line 27 def excluded_path_patterns @excluded_path_patterns ||= [] end |
- (Object) expand_path(file_name)
19 20 21 |
# File 'lib/sparrowhawk/file_entry_mapper.rb', line 19 def file_name File. file_name end |
- (Object) file_entry_tuples
13 14 15 16 17 |
# File 'lib/sparrowhawk/file_entry_mapper.rb', line 13 def file_entry_tuples Dir.glob(file_pattern).uniq.map do |f| [entry_name(f), (f)] end end |