class Mvn2::FilterTypes

Public Class Methods

def_filter() click to toggle source
# File lib/mvn2/plugin.rb, line 63
def self.def_filter
  register_type(:line_filter) { |list, line|
    options = Plugins.get_var :options
    line    = line.chomp
    result  = nil
    begin
      list.sort_by { |v| -v[:options][:priority] }.each { |item|
        tmp = item[:block].call(options, line)
        unless tmp.nil?
          result = tmp || nil
          break
        end
      }
    rescue
      result = line
    end
    result
  }
end