Class: Vanguard::Violation

Inherits:
Object
  • Object
show all
Includes:
Adamantium::Flat
Defined in:
lib/vanguard/violation.rb

Overview

Rule violation on resouce

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#resourceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return object validated in this violation

Returns:

  • (Object)


14
15
16
# File 'lib/vanguard/violation.rb', line 14

def resource
  @resource
end

#ruleVanguard::Rule (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Rule which generated this Violation

Returns:



22
23
24
# File 'lib/vanguard/violation.rb', line 22

def rule
  @rule
end

Instance Method Details

#attribute_nameSymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Name of the attribute which this Violation pertains to

Returns:

  • (Symbol)

    the name of the validated attribute associated with this violation



31
32
33
# File 'lib/vanguard/violation.rb', line 31

def attribute_name
  rule.attribute_name
end

#infoHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return violation info

Returns:

  • (Hash)


51
52
53
# File 'lib/vanguard/violation.rb', line 51

def info
  rule.violation_info.merge(:value => @value)
end

#typeSymbol

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return symbolic type of rule

Returns:

  • (Symbol)


41
42
43
# File 'lib/vanguard/violation.rb', line 41

def type
  rule.type
end

#valuesObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return Violation values

Returns:

  • (Object)


62
63
64
# File 'lib/vanguard/violation.rb', line 62

def values
  rule.violation_values
end