Class: Labkit::RateLimit::Config::Schema::Violation

Inherits:
Data
  • Object
show all
Defined in:
lib/labkit/rate_limit/config/schema.rb

Overview

for_key marks a violation on a map key; its path is the entry's path.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, rule_id:, message:, for_key: false) ⇒ Violation

Returns a new instance of Violation.



30
31
32
# File 'lib/labkit/rate_limit/config/schema.rb', line 30

def initialize(path:, rule_id:, message:, for_key: false)
  super
end

Instance Attribute Details

#for_key ⇒ Object (readonly)

Returns the value of attribute for_key

Returns:

  • (Object) —

    the current value of for_key



29
30
31
# File 'lib/labkit/rate_limit/config/schema.rb', line 29

def for_key
  @for_key
end

#message ⇒ Object (readonly)

Returns the value of attribute message

Returns:

  • (Object) —

    the current value of message



29
30
31
# File 'lib/labkit/rate_limit/config/schema.rb', line 29

def message
  @message
end

#path ⇒ Object (readonly)

Returns the value of attribute path

Returns:

  • (Object) —

    the current value of path



29
30
31
# File 'lib/labkit/rate_limit/config/schema.rb', line 29

def path
  @path
end

#rule_id ⇒ Object (readonly)

Returns the value of attribute rule_id

Returns:

  • (Object) —

    the current value of rule_id



29
30
31
# File 'lib/labkit/rate_limit/config/schema.rb', line 29

def rule_id
  @rule_id
end

Instance Method Details

#to_s ⇒ Object



34
35
36
# File 'lib/labkit/rate_limit/config/schema.rb', line 34

def to_s
  path.empty? ? "#{message} (#{rule_id})" : "#{path}: #{message} (#{rule_id})"
end