Sha256: 91337806863bf903ad60d275739e9559aba915c51a82d3382988b525202df223
Contents?: true
Size: 1.73 KB
Versions: 2
Compression:
Stored size: 1.73 KB
Contents
# encoding: utf-8 module Veritas class Function class Predicate # A predicate representing an exclusion test class Exclusion < Predicate include Enumerable # Test an enumerable to see if a value is excluded # # @example # Exclusion.call(1, [ 1, 2, 3 ]) # => false # # @param [Object] left # the object to test for in the Enumerable # @param [Enumerable] right # the enumerable to test # # @return [Boolean] # # @api public def self.call(left, right) !right.send(Enumerable.compare_method(right), left) end # Return the inverse predicate class # # @example # Exclusion.inverse # => Inclusion # # @return [Class<Inclusion>] # # @api public def self.inverse Inclusion end # Return a string representing the predicate # # @example # exclusion.inspect # => "<Attribute::Integer name: id> ∉ [1, 2, 3]" # # @return [String] # # @api public def inspect "(#{left.inspect} ∉ #{right.inspect})" end module Methods # Compare the left to see if it is excluded from the right # # @example # exclusion = attribute.exclude([ 1, 2, 3 ]) # # @param [Function] other # # @return [Exclusion] # # @api public def exclude(other) Exclusion.new(self, other) end end # module Methods end # class Exclusion end # class Predicate end # class Function end # module Veritas
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
veritas-0.0.5 | lib/veritas/function/predicate/exclusion.rb |
veritas-0.0.4 | lib/veritas/function/predicate/exclusion.rb |