Class: Thredded::AtNotificationExtractor

Inherits:
Object
  • Object
show all
Defined in:
app/commands/thredded/at_notification_extractor.rb

Instance Method Summary collapse

Constructor Details

#initialize(content) ⇒ AtNotificationExtractor

Returns a new instance of AtNotificationExtractor.



3
4
5
# File 'app/commands/thredded/at_notification_extractor.rb', line 3

def initialize(content)
  @content = content
end

Instance Method Details

#run ⇒ Object



7
8
9
10
11
12
13
# File 'app/commands/thredded/at_notification_extractor.rb', line 7

def run
  scanned_names = @content.scan(/@([\w]+)(\W)?/)
  scanned_names += @content.scan(/@"([\w\ ]+)"(\W)?/)
  scanned_names
    .map(&:first)
    .uniq
end