Class: ActsAsMentionable::MentionsUpdater

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_mentionable/mentions_updater.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mentioner, changes) ⇒ MentionsUpdater

Returns a new instance of MentionsUpdater.



5
6
7
8
# File 'lib/acts_as_mentionable/mentions_updater.rb', line 5

def initialize mentioner, changes
  @mentioner = mentioner
  @changes = changes
end

Instance Attribute Details

#changesObject (readonly)

Returns the value of attribute changes.



3
4
5
# File 'lib/acts_as_mentionable/mentions_updater.rb', line 3

def changes
  @changes
end

#mentionerObject (readonly)

Returns the value of attribute mentioner.



3
4
5
# File 'lib/acts_as_mentionable/mentions_updater.rb', line 3

def mentioner
  @mentioner
end

Instance Method Details

#callObject



10
11
12
13
14
15
16
17
# File 'lib/acts_as_mentionable/mentions_updater.rb', line 10

def call
  Mention.transaction do
    remove_old_mentionables
    add_new_mentionables
    invoke_mentions_updated_callback
    yield if block_given?
  end
end