module Thunderer::PublishChanges

Attributes

block[RW]
channels[RW]
options[RW]

Public Instance Methods

message_root() click to toggle source
# File lib/thunderer/publish_changes.rb, line 31
def message_root
  self.class.options[:message_root]
end
message_root?() click to toggle source
# File lib/thunderer/publish_changes.rb, line 35
def message_root?
  message_root.present?
end
notification_message() click to toggle source
# File lib/thunderer/publish_changes.rb, line 26
def notification_message
  block = self.class.block
  block ? block.call(self) : self
end
publish_changes() click to toggle source
# File lib/thunderer/publish_changes.rb, line 15
def publish_changes
  (self.class.channels || []).each do |channel|
    rooted_message = if message_root?
                       Hash[message_root, notification_message]
                     else
                       notification_message
                     end
    Thunderer.publish_to Thunderer::ChannelParser.interpolate_channel(channel, self), rooted_message
  end
end