Sha256: 2c769a791562e2cd298df02b8c0cdf90fb8cdf1491d8591f8365a560aeecf08c
Contents?: true
Size: 648 Bytes
Versions: 2
Compression:
Stored size: 648 Bytes
Contents
# Normalizator::NumericRule module module Normalizator class NumericRule < BaseRule def apply(value, _original_row) value_on_failure = get_value_on_failure(value) apply_numeric_rules value_on_failure, value.to_i end private def apply_numeric_rules(value_on_failure, value) return value_on_failure if @options[:positive] && value < 0 return value_on_failure if @options[:negative] && value >= 0 return value_on_failure if @options[:greater_than] && value < @options[:greater_than] return value_on_failure if @options[:less_than] && value > @options[:less_than] value end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
normalizator-0.0.1 | lib/rules/numeric_rule.rb |
normalizator-0.0.0 | lib/rules/numeric_rule.rb |