Sha256: 2f5d91579d33d9bc2d0c40168e47aca82812a4b28cabc0d95894e2b0c0d14487
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
module Dle class Application module Filter def filter_script name File.expand_path("~/.dle/#{name}.rb") end def apply_filter collection, file app = @app eval File.read(file), binding, file collection end 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 def record_filter file = nil file ||= "#{Dir.tmpdir}/#{SecureRandom.urlsafe_base64}.rb" FileUtils.mkdir(File.dirname(file)) if !File.exist?(File.dirname(file)) if !File.exist?(file) || File.read(file).strip.empty? FileUtils.cp("#{ROOT}/lib/dle/application/filter.tpl", file) end open_editor(file) file end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dle-1.0.1 | lib/dle/application/filter.rb |