Sha256: 0e385991eff4f0ef82411e4525941e6c74a9c99b3bb4fe910bf886a57d6af134
Contents?: true
Size: 1.25 KB
Versions: 4
Compression:
Stored size: 1.25 KB
Contents
module WAB module Impl # Matches numeric nodes between a minimum and maximum value. By default # the matches are inclusive of the minimum and maximum. The optional # arguments allow the inclusivity to be changed to exclusive separately # for the minimum and maximum. By default the min_incl and max_incl are # true. If set to false the corresponding limit becomes exclusive. An # error is returned if used with non-numeric minimum or maximum. class Between < PathExpr # Creates a new instance with the provided parameters. # # path:: path to the value to compare # min:: minimum # max:: maximum # min_incl:: minimum inclusive flag # max_incl:: maximum inclusive flag def initialize(path, min, max, min_incl=true, max_incl=true) super(path) @min = min @max = max @min_incl = min_incl @max_incl = max_incl end def eval(data) value = data.get(path) return false if (@min_incl ? value < @min : value <= @min) return false if (@max_incl ? @max < value : @max <= value) true end def native() ['BETWEEN', path, @min, @max, @min_incl, @max_incl] end end # Between end # Impl end # WAB
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
wabur-0.7.0 | lib/wab/impl/exprs/between.rb |
wabur-0.6.2 | lib/wab/impl/exprs/between.rb |
wabur-0.6.1 | lib/wab/impl/exprs/between.rb |
wabur-0.6.0 | lib/wab/impl/exprs/between.rb |