Sha256: 32a6458234fe7e793ac0e63856eaadc475351205cc50e08cbb867b4c5e6741e2

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 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, @negate, &actual)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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