Class: Fluent::InlineClassifierOutput::RangeClassifier
- Inherits:
-
Classifier
- Object
- Classifier
- Fluent::InlineClassifierOutput::RangeClassifier
- Defined in:
- lib/fluent/plugin/out_inline_classifier.rb
Instance Attribute Summary
Attributes inherited from Classifier
Instance Method Summary collapse
-
#initialize(key, store, rules) ⇒ RangeClassifier
constructor
A new instance of RangeClassifier.
Methods inherited from Classifier
Constructor Details
#initialize(key, store, rules) ⇒ RangeClassifier
Returns a new instance of RangeClassifier.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/fluent/plugin/out_inline_classifier.rb', line 35 def initialize(key, store, rules) super @rules = [] rules.each {|name, args| args = args.split() from = args[0].to_f to = args[1].to_f if args[0] == '*' func = lambda {|v| v.to_f < to} elsif args[1] == '*' func = lambda {|v| from <= v.to_f} else func = lambda {|v| v = v.to_f; from <= v and v < to} end @rules << [name, func] } end |