Module: LogCabin::Modules::Filter

Defined in:
lib/prospectus/helpers/filter.rb

Overview

Use regex to filter out from a list of matches

Instance Method Summary collapse

Instance Method Details

#filter_helper(list) ⇒ Object



6
7
8
9
10
11
# File 'lib/prospectus/helpers/filter.rb', line 6

def filter_helper(list)
  return list unless @filter_regex
  new_list = list.select { |x| x =~ @filter_regex }
  return new_list unless new_list.empty?
  raise("No matches found in list: #{@filter_regex} / #{list}")
end