Sha256: 40e33a33e4dfae8ee4cb6571449b6d620b336ed677c306328d0b2a36ab795034

Contents?: true

Size: 712 Bytes

Versions: 1

Compression:

Stored size: 712 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)
      super()
      @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

1 entries across 1 versions & 1 rubygems

Version Path
shiyo-0.1.0 lib/shiyo/not.rb