diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0a40bdf19..2a7113d18 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -14,11 +14,6 @@ Lint/InheritException: Exclude: - 'app/controllers/concerns/feature_flags.rb' -# Offense count: 7 -Lint/NestedMethodDefinition: - Exclude: - - 'lib/acts_as_paranoid_aliases.rb' - # Offense count: 13 Lint/ParenthesesAsGroupedExpression: Exclude: diff --git a/lib/acts_as_paranoid_aliases.rb b/lib/acts_as_paranoid_aliases.rb index 4f69ee65a..cf0c0bac8 100644 --- a/lib/acts_as_paranoid_aliases.rb +++ b/lib/acts_as_paranoid_aliases.rb @@ -2,36 +2,38 @@ module ActsAsParanoidAliases def self.included(base) base.extend(ClassMethods) + self.class_eval do - def hide - return false if hidden? - update_attribute(:hidden_at, Time.current) - after_hide - end + def hide + return false if hidden? + update_attribute(:hidden_at, Time.current) + after_hide + end - def hidden? - deleted? - end + def hidden? + deleted? + end - def after_hide - end + def after_hide + end - def confirmed_hide? - confirmed_hide_at.present? - end + def confirmed_hide? + confirmed_hide_at.present? + end - def confirm_hide - update_attribute(:confirmed_hide_at, Time.current) - end + def confirm_hide + update_attribute(:confirmed_hide_at, Time.current) + end - def restore(opts={}) - return false unless hidden? - super(opts) - update_attribute(:confirmed_hide_at, nil) - after_restore - end + def restore(opts={}) + return false unless hidden? + super(opts) + update_attribute(:confirmed_hide_at, nil) + after_restore + end - def after_restore + def after_restore + end end end