Method: Inspec::Rule#initialize

Defined in:
lib/inspec/rule.rb

#initialize(id, profile_id, _opts, &block) ⇒ Rule

Returns a new instance of Rule.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/inspec/rule.rb', line 15

def initialize(id, profile_id, _opts, &block)
  @impact = nil
  @title = nil
  @desc = nil
  @refs = []
  @tags = {}

  # not changeable by the user:
  @__block = block
  @__code = __get_block_source(&block)
  @__source_location = __get_block_source_location(&block)
  @__rule_id = id
  @__profile_id = profile_id
  @__checks = []
  @__skip_rule = nil

  # evaluate the given definition
  instance_eval(&block) if block_given?
end