module AdHocTemplate::Utils
Constants
- FILE_EXTENTIONS
Public Instance Methods
guess_file_format(filename)
click to toggle source
# File lib/ad_hoc_template/utils.rb, line 12 def guess_file_format(filename) if_any_regex_match(FILE_EXTENTIONS, filename) do |_, format| return format end end
if_any_regex_match(regex_table, target, failure_message=nil) { |re, paired_value| ... }
click to toggle source
# File lib/ad_hoc_template/utils.rb, line 18 def if_any_regex_match(regex_table, target, failure_message=nil) regex_table.each do |re, paired_value| if re =~ target yield re, paired_value return nil end end STDERR.puts failure_message if failure_message nil end
Private Instance Methods
csv_or_tsv?(format)
click to toggle source
# File lib/ad_hoc_template/utils.rb, line 31 def csv_or_tsv?(format) %i[csv tsv].include? format end