Class: Tuxedo::CaneViolation::ThresholdViolation

Inherits:
Tuxedo::CaneViolation show all
Defined in:
lib/tuxedo/cane_violation/threshold_violation.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Tuxedo::CaneViolation

#violation_type, #violation_type_snake_cased

Instance Attribute Details

#limitObject

Returns the value of attribute limit.



4
5
6
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 4

def limit
  @limit
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 4

def name
  @name
end

#operatorObject

Returns the value of attribute operator.



4
5
6
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 4

def operator
  @operator
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 4

def value
  @value
end

Class Method Details

.from_cane(cane_violation) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 6

def self.from_cane(cane_violation)
  violation = new

  violation.name     = cane_violation.name
  violation.operator = cane_violation.operator
  violation.value    = cane_violation.value
  violation.limit    = cane_violation.limit

  violation
end

Instance Method Details

#descriptionObject



17
18
19
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 17

def description
  "Quality threshold crossed"
end

#to_hashObject



21
22
23
24
25
26
27
28
29
30
# File 'lib/tuxedo/cane_violation/threshold_violation.rb', line 21

def to_hash
  {
    :violation_type => violation_type,
    :name           => name,
    :operator       => operator,
    :value          => value,
    :limit          => limit,
    :description    => description,
  }
end