Sha256: 03ed563a5361fbe9e2bf51721867f3102bd8c1f84ce1958e9c9821ad9e959fa5

Contents?: true

Size: 672 Bytes

Versions: 1

Compression:

Stored size: 672 Bytes

Contents

require_relative 'sandbox'

module Spectus
  # Requirement level's base class.
  #
  # @api private
  #
  class Requirement < BasicObject
    # Initialize the requirement level class.
    #
    # @param [Hash] definition
    # @param [Boolean] negate
    def initialize(definition, negate = false)
      @definition = definition
      @negate     = negate
    end

    protected

    # Run the actual block against the definition.
    #
    # @yieldparam actual the value which is compared with the expected value.
    #
    # @return [Boolean] report if the expectation is true or false.
    def sandbox(&actual)
      Sandbox.new(@definition, &actual)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
spectus-2.0.2 lib/spectus/requirement.rb