Sha256: 042984b6b071f65c2622c74e229589e05cc00f8af4bad1261791990ad5dd22c6

Contents?: true

Size: 698 Bytes

Versions: 2

Compression:

Stored size: 698 Bytes

Contents

# frozen_string_literal: true

module Shiyo
  # The class to create a wrapper specification for checking
  # whether the candidate does not satisfy the wrapped specification.
  class Not
    include Shiyo::Specification
    # A new instance of Shiyo::Not
    #
    # @param wrapped [Shiyo::Specification] A specification object.
    def initialize(wrapped)
      @wrapped = Shiyo::Specification(wrapped)
    end

    # Inspects whether the candidate does not satisfy the wrapped specification.
    #
    # @param candidate [Object] The candidate object to be inspected.
    # @return [Boolean] The result.
    def satisfied_by?(candidate)
      !@wrapped.satisfied_by?(candidate)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shiyo-0.1.2 lib/shiyo/not.rb
shiyo-0.1.1 lib/shiyo/not.rb