Class: ArchUnit::Files::Assertion::CustomFileViolation

Inherits:
Common::Assertion::Violation show all
Defined in:
lib/archunit/files/assertion/custom_file_condition.rb

Overview

Data describing a file that disagrees with a custom predicate.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_info:, message:, is_negated: false) ⇒ CustomFileViolation

Returns a new instance of CustomFileViolation.



14
15
16
17
18
19
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 14

def initialize(file_info:, message:, is_negated: false)
  @file_info = file_info_value(file_info)
  @message = message_value(message)
  @is_negated = boolean_value(is_negated)
  super()
end

Instance Attribute Details

#file_infoObject (readonly)

Returns the value of attribute file_info.



12
13
14
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 12

def file_info
  @file_info
end

#is_negatedObject (readonly)

Returns the value of attribute is_negated.



12
13
14
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 12

def is_negated
  @is_negated
end

#messageObject (readonly)

Returns the value of attribute message.



12
13
14
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 12

def message
  @message
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



25
26
27
28
29
30
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 25

def ==(other)
  other.is_a?(self.class) &&
    file_info == other.file_info &&
    message == other.message &&
    is_negated == other.is_negated
end

#hashObject



33
34
35
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 33

def hash
  [self.class, file_info, message, is_negated].hash
end

#negated?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/archunit/files/assertion/custom_file_condition.rb', line 21

def negated?
  is_negated
end