Class: RuleDefinition
Direct Known Subclasses
Constant Summary collapse
- WARNING =
'WARN'
- FAILING_VIOLATION =
'FAIL'
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(id:, name:, type:, message:) ⇒ RuleDefinition
constructor
A new instance of RuleDefinition.
- #to_h ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(id:, name:, type:, message:) ⇒ RuleDefinition
Returns a new instance of RuleDefinition.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/cfn-nag/rule_definition.rb', line 9 def initialize(id:, name:, type:, message:) @id = id @name = name @type = type @message = [@id, @type, @name, @message].each do |required| raise 'No parameters to Violation constructor can be nil' if required.nil? end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/cfn-nag/rule_definition.rb', line 7 def id @id end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
7 8 9 |
# File 'lib/cfn-nag/rule_definition.rb', line 7 def @message end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/cfn-nag/rule_definition.rb', line 7 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/cfn-nag/rule_definition.rb', line 7 def type @type end |
Instance Method Details
#==(other) ⇒ Object
36 37 38 |
# File 'lib/cfn-nag/rule_definition.rb', line 36 def ==(other) other.class == self.class && other.to_h == to_h end |
#to_h ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/cfn-nag/rule_definition.rb', line 27 def to_h { id: @id, name: @name, type: @type, message: @message } end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/cfn-nag/rule_definition.rb', line 23 def to_s "#{@id} #{name} #{@type} #{@message}" end |