Sha256: a39718fbefb035197504822409d0c5a60625666f644e1c194568bafee496cf49
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
require 'range_dsl' module RangeDsl module OpenRangeExp POSITIVE_INFINITY = 1.0/0 NEGATIVE_INFINITY = -1.0/0 class Base include ConnectionExp::Client attr_accessor :value def initialize(value) @value = value end def include?(v) to_range.include?(v) end def inspect "#{name_for_inspect}(#{@value.inspect})" end end class GreaterThanEqual < Base def name_for_inspect; "gte"; end def to_range @range ||= (@value..POSITIVE_INFINITY) end end class GreaterThan < GreaterThanEqual def name_for_inspect; "gt"; end def include?(v) return false if RangeDsl.equal_with_considering_numeric(@value, v) to_range.include?(v) end end class LessThanEqual < Base def name_for_inspect; "lte"; end def to_range @range ||= (NEGATIVE_INFINITY..@value) end end class LessThan < Base def name_for_inspect; "lt"; end def to_range @range ||= (NEGATIVE_INFINITY...@value) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
range_dsl-0.1.2 | lib/range_dsl/open_range_exp.rb |
range_dsl-0.1.1 | lib/range_dsl/open_range_exp.rb |
range_dsl-0.1.0 | lib/range_dsl/open_range_exp.rb |