diff options
author | Peter Leitzen <pleitzen@gitlab.com> | 2019-09-02 18:05:33 +0000 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2019-09-02 18:05:33 +0000 |
commit | e0ce29ad06e31bf6d60a747d01396c410262ddcd (patch) | |
tree | 675789c2ec68d553df98237438604560265e396b /app/models | |
parent | d3076322f230cea1f60a7e27d7ae6e1fb770234a (diff) | |
download | gitlab-ce-e0ce29ad06e31bf6d60a747d01396c410262ddcd.tar.gz |
Provide filename and line number for `class_eval`
This commit removes one RuboCop offense from its todo file.
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/service.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/service.rb b/app/models/service.rb index f6d8fb1fb46..431c5881460 100644 --- a/app/models/service.rb +++ b/app/models/service.rb @@ -174,7 +174,7 @@ class Service < ApplicationRecord # Also keep track of updated properties in a similar way as ActiveModel::Dirty def self.prop_accessor(*args) args.each do |arg| - class_eval %{ + class_eval <<~RUBY, __FILE__, __LINE__ + 1 unless method_defined?(arg) def #{arg} properties['#{arg}'] @@ -198,7 +198,7 @@ class Service < ApplicationRecord def #{arg}_was updated_properties['#{arg}'] end - } + RUBY end end @@ -209,12 +209,12 @@ class Service < ApplicationRecord self.prop_accessor(*args) args.each do |arg| - class_eval %{ + class_eval <<~RUBY, __FILE__, __LINE__ + 1 def #{arg}? # '!!' is used because nil or empty string is converted to nil !!ActiveRecord::Type::Boolean.new.cast(#{arg}) end - } + RUBY end end |