Class: Mvn2::FilterTypes

Inherits:
Object
  • Object
show all
Extended by:
PluginType, TypeHelper
Defined in:
lib/mvn2/plugin.rb

Class Method Summary collapse

Class Method Details

.def_filterObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# 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