Sha256: be8fdd43b114df9f514a5b2020eac991ffe9210c3cd3b4468e898a27ca362719
Contents?: true
Size: 1.46 KB
Versions: 12
Compression:
Stored size: 1.46 KB
Contents
# encoding: UTF-8 module Plucky module Extensions module Symbol def gt SymbolOperator.new(self, 'gt') end def lt SymbolOperator.new(self, 'lt') end def gte SymbolOperator.new(self, 'gte') end def lte SymbolOperator.new(self, 'lte') end def ne SymbolOperator.new(self, 'ne') end def in SymbolOperator.new(self, 'in') end def nin SymbolOperator.new(self, 'nin') end def mod SymbolOperator.new(self, 'mod') end def all SymbolOperator.new(self, 'all') end def size SymbolOperator.new(self, 'size') end unless Symbol.instance_methods.include?(:size) # Ruby 1.9 defines symbol size def exists SymbolOperator.new(self, 'exists') end def asc SymbolOperator.new(self, 'asc') end def desc SymbolOperator.new(self, 'desc') end end end end class SymbolOperator include Comparable attr_reader :field, :operator def initialize(field, operator, options={}) @field, @operator = field, operator end unless method_defined?(:initialize) def <=>(other) if field == other.field operator <=> other.operator else field.to_s <=> other.field.to_s end end def ==(other) field == other.field && operator == other.operator end end class Symbol include Plucky::Extensions::Symbol end
Version data entries
12 entries across 12 versions & 2 rubygems