Class: Stormbreaker::AxeViolation
- Inherits:
-
Object
- Object
- Stormbreaker::AxeViolation
- Defined in:
- lib/stormbreaker/axe_violation.rb
Instance Attribute Summary collapse
-
#called_by ⇒ Object
Returns the value of attribute called_by.
-
#complete_summary ⇒ Object
Returns the value of attribute complete_summary.
-
#element ⇒ Object
Returns the value of attribute element.
-
#severity ⇒ Object
Returns the value of attribute severity.
-
#violation ⇒ Object
Returns the value of attribute violation.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(called_by: Set.new, severity: "", element: "", violation: "", complete_summary: "") ⇒ AxeViolation
constructor
A new instance of AxeViolation.
- #violation_count ⇒ Object
Constructor Details
#initialize(called_by: Set.new, severity: "", element: "", violation: "", complete_summary: "") ⇒ AxeViolation
Returns a new instance of AxeViolation.
7 8 9 10 11 12 13 |
# File 'lib/stormbreaker/axe_violation.rb', line 7 def initialize(called_by: Set.new, severity: "", element: "", violation: "", complete_summary: "") self.called_by = Set.new.merge(called_by) self.severity = severity self.violation = violation self.element = element self.complete_summary = complete_summary end |
Instance Attribute Details
#called_by ⇒ Object
Returns the value of attribute called_by.
5 6 7 |
# File 'lib/stormbreaker/axe_violation.rb', line 5 def called_by @called_by end |
#complete_summary ⇒ Object
Returns the value of attribute complete_summary.
5 6 7 |
# File 'lib/stormbreaker/axe_violation.rb', line 5 def complete_summary @complete_summary end |
#element ⇒ Object
Returns the value of attribute element.
5 6 7 |
# File 'lib/stormbreaker/axe_violation.rb', line 5 def element @element end |
#severity ⇒ Object
Returns the value of attribute severity.
5 6 7 |
# File 'lib/stormbreaker/axe_violation.rb', line 5 def severity @severity end |
#violation ⇒ Object
Returns the value of attribute violation.
5 6 7 |
# File 'lib/stormbreaker/axe_violation.rb', line 5 def violation @violation end |
Instance Method Details
#==(other) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/stormbreaker/axe_violation.rb', line 21 def ==(other) called_by == other.called_by && severity == other.severity && violation == other.violation && element == other.element && complete_summary == other.complete_summary end |
#violation_count ⇒ Object
15 16 17 18 19 |
# File 'lib/stormbreaker/axe_violation.rb', line 15 def violation_count return 0 if called_by.to_a.empty? called_by.to_a.map { |spec| spec.to_s.match(/(.*):/) }.uniq.count end |