Module: Patriot::Util::Script
Overview
a module to find target files
Instance Method Summary collapse
-
#get_batch_files(path, date, opt = {}) ⇒ Array<String>
get target batch files from a given path.
Methods included from DateUtil
#date_add, #date_add_year, #date_format, #date_sub, #date_sub_year, #date_to_month, #days_of_month, #days_of_month_until, #days_of_week, #hours, #month_add, #month_sub, #to_date_obj, #to_end_of_last_month, #to_end_of_month, #to_month, #to_start_of_month
Instance Method Details
#get_batch_files(path, date, opt = {}) ⇒ Array<String>
get target batch files from a given path
13 14 15 16 17 18 19 20 21 |
# File 'lib/patriot/util/script.rb', line 13 def get_batch_files(path, date, opt = {}) return [path] if File.file?(path) && File.extname(path) == ".pbc" files = [] opt = target_option(date, opt) files = Dir.glob("#{path}/**/*.pbc").find_all do |file| target_file?(file, opt) end return files end |