Class: LogStash::Filters::MathFunctions::Power
- Inherits:
-
Object
- Object
- LogStash::Filters::MathFunctions::Power
- Includes:
- Util::Loggable
- Defined in:
- lib/logstash/filters/math_functions.rb
Instance Method Summary collapse
Instance Method Details
#call(op1, op2) ⇒ Object
83 84 85 |
# File 'lib/logstash/filters/math_functions.rb', line 83 def call(op1, op2) op1 ** op2 end |
#invalid?(op1, op2, event = nil) ⇒ Boolean
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/logstash/filters/math_functions.rb', line 87 def invalid?(op1, op2, event = nil) if op1.is_a?(Numeric) && op1 < 0 && !op2.integer? warning = "raising a negative number to a fractional exponent results in a complex number that cannot be stored in an event" if event # called from filter so log logger.warn(warning, "operand 1" => op1, "operand 2" => op2, "event" => event.to_hash) return true else # called from register don't log return warning for the error that is raised return warning end end nil end |
#name ⇒ Object
79 80 81 |
# File 'lib/logstash/filters/math_functions.rb', line 79 def name "power" end |