Class: Violation

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

Constant Summary collapse

WARNING =
'warning'
FATAL_VIOLATION =
'fatal violation'
FAILING_VIOLATION =
'failing violation'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, message:, logical_resource_ids: nil, violating_code: nil) ⇒ Violation

Returns a new instance of Violation.



9
10
11
12
13
14
15
16
17
# File 'lib/violation.rb', line 9

def initialize(type:,
               message:,
               logical_resource_ids: nil,
               violating_code: nil)
  @type = type
  @message = message
  @logical_resource_ids = logical_resource_ids
  @violating_code = violating_code
end

Instance Attribute Details

#logical_resource_idsObject (readonly)

Returns the value of attribute logical_resource_ids.



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

def logical_resource_ids
  @logical_resource_ids
end

#messageObject (readonly)

Returns the value of attribute message.



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

def message
  @message
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#violating_codeObject (readonly)

Returns the value of attribute violating_code.



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

def violating_code
  @violating_code
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/violation.rb', line 19

def to_s
  puts "#{@type} #{@message} #{@logical_resource_ids} #{@violating_code}"
end