Class: Inspec::DescribeBase

Inherits:
Object
  • Object
show all
Defined in:
lib/inspec/describe.rb

Instance Method Summary collapse

Constructor Details

#initialize(action) ⇒ DescribeBase

Returns a new instance of DescribeBase.



3
4
5
6
# File 'lib/inspec/describe.rb', line 3

def initialize(action)
  @action = action
  @checks = []
end

Instance Method Details

#describe(*args, &block) ⇒ Object



20
21
22
# File 'lib/inspec/describe.rb', line 20

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

#one(&block) ⇒ nil

Evaluate the given block and collect all checks. These will be registered with the callback function under the ‘describe.one’ name.

Parameters:

  • ruby (Proc)

    block containing checks (e.g. via describe)

Returns:

  • (nil)


13
14
15
16
17
18
# File 'lib/inspec/describe.rb', line 13

def one(&block)
  return unless block_given?

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