Class: Spacelift::Policy::Violation

Inherits:
Object
  • Object
show all
Defined in:
lib/spacelift/policy/violation.rb

Overview

Violation encapsulates a resource’s violation of a single Rule.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(address:, rule:) ⇒ Violation

Returns a new instance of Violation.



9
10
11
12
# File 'lib/spacelift/policy/violation.rb', line 9

def initialize(address:, rule:)
  @address = address
  @rule = rule
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



7
8
9
# File 'lib/spacelift/policy/violation.rb', line 7

def address
  @address
end

#ruleObject (readonly)

Returns the value of attribute rule.



7
8
9
# File 'lib/spacelift/policy/violation.rb', line 7

def rule
  @rule
end

Instance Method Details

#to_sObject



14
15
16
# File 'lib/spacelift/policy/violation.rb', line 14

def to_s
  [address.red.bold, 'failed rule', rule.cyan.bold].join(' ')
end