Fix Lint/NestedMethodDefinition rubocop issue and remove it from rubocop_todo list

This commit is contained in:
Bertocq
2017-06-16 00:24:07 +02:00
parent 6e1fa53e2c
commit db97314f7b
2 changed files with 25 additions and 28 deletions

View File

@@ -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:

View File

@@ -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