Class: HTML::Pipeline::AtMentionFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/html/pipeline/at_mention_filter.rb

Instance Method Summary collapse

Constructor Details

#initialize(text, context = nil, result = nil) ⇒ AtMentionFilter

Returns a new instance of AtMentionFilter.



6
7
8
9
10
11
# File 'lib/html/pipeline/at_mention_filter.rb', line 6

def initialize(text, context = nil, result = nil)
  super text, context, result
  @text = text.to_s.gsub "\r", ''
  @post = context[:post]
  @view_context = context[:view_context]
end

Instance Method Details

#call ⇒ Object



13
14
15
16
17
# File 'lib/html/pipeline/at_mention_filter.rb', line 13

def call
  html = Thredded::AtUsers.render(@text, @post, @view_context)
  html.rstrip!
  html
end