Apply automatic rubocop fixes

This commit is contained in:
Sebastian Serth
2021-05-14 10:51:44 +02:00
parent fe4000916c
commit 6cbecb5b39
440 changed files with 2705 additions and 1853 deletions

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
class StructuredErrorAttribute < ApplicationRecord
belongs_to :structured_error
belongs_to :error_template_attribute
@ -5,11 +7,10 @@ class StructuredErrorAttribute < ApplicationRecord
def self.create_from_template(attribute, structured_error, message_buffer)
value = nil
result = message_buffer.match(attribute.regex)
if result != nil
if result.captures.size > 0
value = result.captures[0]
end
if !result.nil? && result.captures.size.positive?
value = result.captures[0]
end
self.create(structured_error: structured_error, error_template_attribute: attribute, value: value, match: result != nil)
create(structured_error: structured_error, error_template_attribute: attribute, value: value,
match: !result.nil?)
end
end