Method: HTML::Pipeline::MentionFilter.mentioned_logins_in
- Defined in:
- lib/html/pipeline/@mention_filter.rb
.mentioned_logins_in(text, username_pattern = UsernamePattern) ⇒ Object
Public: Find user @mentions in text. See MentionFilter#mention_link_filter.
MentionFilter.mentioned_logins_in(text) do |match, login, is_mentioned|
"<a href=...>#{login}</a>"
end
text - String text to search.
Yields the String match, the String login name, and a Boolean determining if the match = “@mention”. The yield’s return replaces the match in the original text.
Returns a String replaced with the return of the block.
32 33 34 35 36 37 |
# File 'lib/html/pipeline/@mention_filter.rb', line 32 def self.mentioned_logins_in(text, username_pattern = UsernamePattern) text.gsub MentionPatterns[username_pattern] do |match| login = Regexp.last_match(1) yield match, login, MentionLogins.include?(login.downcase) end end |