Sha256: 5db718a1b511984f965100a33e7e088c4e6404f7cd152192d138e8e95b53cfa0

Contents?: true

Size: 720 Bytes

Versions: 6

Compression:

Stored size: 720 Bytes

Contents

module Inspec
  class DescribeBase
    def initialize(action)
      @action = action
      @checks = []
    end

    # Evaluate the given block and collect all checks. These will be registered
    # with the callback function under the 'describe.one' name.
    #
    # @param [Proc] ruby block containing checks (e.g. via describe)
    # @return [nil]
    def one(&block)
      return unless block_given?

      instance_eval(&block)
      @action.call("describe.one", @checks, nil)
    end

    def method_missing(method_name, *arguments)
      Inspec::DSL.method_missing_resource(inspec, method_name, *arguments)
    end

    def describe(*args, &block)
      @checks.push(["describe", args, block])
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
inspec-core-4.18.24 lib/inspec/describe_base.rb
inspec-4.18.24 lib/inspec/describe_base.rb
inspec-core-4.18.0 lib/inspec/describe.rb
inspec-4.18.0 lib/inspec/describe.rb
inspec-core-4.17.17 lib/inspec/describe.rb
inspec-4.17.17 lib/inspec/describe.rb