module ElchScan::Filter

Public Instance Methods

apply_filter(collection, file) click to toggle source
# File lib/elch_scan/application/filter.rb, line 7
def apply_filter collection, file
  app = @app
  eval File.read(file), binding, file
  collection
end
filter_script(name) click to toggle source
# File lib/elch_scan/application/filter.rb, line 3
def filter_script name
  "#{ROOT}/tmp/#{name}.esss"
end
permute_script(collection, file = nil) click to toggle source
# File lib/elch_scan/application/filter.rb, line 13
def permute_script collection, file = nil
  file ||= "#{Dir.tmpdir}/#{SecureRandom.urlsafe_base64}"
  FileUtils.mkdir(File.dirname(file)) if !File.exist?(File.dirname(file))
  if !File.exist?(file) || File.read(file).strip.empty?
    File.open(file, "w") {|f| f.puts("# Permute your collection, same as with the selector script filters.") }
  end
  system "#{cfg :application, :editor} #{file}"
  eval File.read(file), binding, file
  collection
end
record_filter(file = nil) click to toggle source
# File lib/elch_scan/application/filter.rb, line 24
def record_filter file = nil
  file ||= "#{Dir.tmpdir}/#{SecureRandom.urlsafe_base64}"
  FileUtils.mkdir(File.dirname(file)) if !File.exist?(File.dirname(file))
  if !File.exist?(file) || File.read(file).strip.empty?
    FileUtils.cp("#{ROOT}/doc/filter.rb", file)
  end
  system "#{cfg :application, :editor} #{file}"
  file
end