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.



7
8
9
10
# File 'lib/inspec/describe.rb', line 7

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

Instance Method Details

#describe(*args, &block) ⇒ Object



23
24
25
# File 'lib/inspec/describe.rb', line 23

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)


17
18
19
20
21
# File 'lib/inspec/describe.rb', line 17

def one(&block)
  return unless block_given?
  instance_eval(&block)
  @action.call('describe.one', @checks, nil)
end