class DTK::DSL::FileType::MatchingFiles
Attributes
file_paths[R]
file_type_instance[R]
Public Class Methods
matching_files_array(file_type_classes, file_paths)
click to toggle source
Returns array of MatchingFiles
# File lib/dsl/file_type/matching_files.rb, line 35 def self.matching_files_array(file_type_classes, file_paths) ndx_ret = {} file_type_classes = [file_type_classes] unless file_type_classes.kind_of?(Array) file_type_classes.each do |file_type_class| file_paths.each do |file_path| if file_type_instance = file_type_class.file_type_instance_if_match?(file_path) file_type_instance_index = file_type_instance.index if matching_index = ndx_ret.keys.find { |index| index == file_type_instance_index } ndx_ret[matching_index].add_file_path!(file_path) else ndx_ret[file_type_instance_index] = new(file_type_instance).add_file_path!(file_path) end end end end ndx_ret.values end
new(file_type_instance)
click to toggle source
# File lib/dsl/file_type/matching_files.rb, line 23 def initialize(file_type_instance) @file_type_instance = file_type_instance @file_paths = [] end
Public Instance Methods
add_file_path!(file_path)
click to toggle source
# File lib/dsl/file_type/matching_files.rb, line 29 def add_file_path!(file_path) @file_paths << file_path self end