Method: Inspec::Rule#initialize

Defined in:
lib/inspec/rule.rb

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

Returns a new instance of Rule.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/inspec/rule.rb', line 33

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
  @__merge_count = 0

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