2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-11-08 19:23:39 +05:30
|
|
|
module Keys
|
|
|
|
class DestroyService < ::Keys::BaseService
|
|
|
|
def execute(key)
|
2021-09-30 23:02:18 +05:30
|
|
|
return unless destroy_possible?(key)
|
|
|
|
|
|
|
|
destroy(key)
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
private
|
|
|
|
|
2018-12-13 13:39:08 +05:30
|
|
|
# overridden in EE::Keys::DestroyService
|
2018-11-08 19:23:39 +05:30
|
|
|
def destroy_possible?(key)
|
|
|
|
true
|
|
|
|
end
|
2021-09-30 23:02:18 +05:30
|
|
|
|
|
|
|
def destroy(key)
|
|
|
|
key.destroy
|
|
|
|
end
|
2018-11-08 19:23:39 +05:30
|
|
|
end
|
|
|
|
end
|
2019-12-04 20:38:33 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
Keys::DestroyService.prepend_mod
|