-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#105] Complete documentation of notification_target & notification_o…
…bject (#106)
- Loading branch information
1 parent
5875d1b
commit cb94e40
Showing
3 changed files
with
20 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,22 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'active_support' | ||
|
||
module NotificationHandler | ||
module Object | ||
def self.included(base) | ||
base.extend(ClassMethods) | ||
end | ||
extend ActiveSupport::Concern | ||
|
||
module ClassMethods | ||
def notification_object | ||
included do | ||
def self.notification_object | ||
has_many :belonging_notifications, | ||
as: :object, class_name: 'Notification', dependent: :destroy | ||
include NotificationHandler::Object::InstanceMethods | ||
|
||
return unless defined?(NotificationSettings) | ||
|
||
include NotificationSettings::Subscribable | ||
# rubocop:disable Style/GuardClause | ||
if defined?(NotificationSettings) | ||
include NotificationSettings::Subscribable | ||
end | ||
# rubocop:enable Style/GuardClause | ||
end | ||
end | ||
|
||
module InstanceMethods | ||
# ... | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters