Class: Alula::Smilies
- Defined in:
- lib/alula/core_ext/filters/smilies.rb
Constant Summary collapse
- MAP =
{ angel: %w{:angel: }, angry: %w{:angry: }, cool: %w{:cool: }, badguy: %w{:badguy: }, crying: %w{:crying: ;( ;-( }, exclamation: %w{:exclamation: }, idea: %w{:idea: }, kiss: %w{:kiss: :* :-* }, laugh: %w{:laugh: :D :-D }, monkey: %w{:monkey: }, plain: %w{:plain: :| :-| }, question: %w{:question: }, tongue: %w{:tongue: }, sad: %w{:sad: :( :-( }, grin: %w{:grin: }, smile: %w{:smile: :) :-) ^^ ^_^}, smirk: %w{:smirk: }, point_right: %w{:point_right: }, surprise: %w{:surprise: }, uncertain: %w{:uncertain: }, wink: %w{:wink: ;) ;-) }, worried: %w{:worried: }, }
- SMILIES =
Hash[*MAP.collect{|cls, keys| keys.collect{|key| [key, "<span class=\"smilies-#{cls}\">#{key}</span>"]
- SMILIES_RE =
Regexp.new(SMILIES.keys.collect{|k| Regexp.escape(k)}.join("|"))
Instance Method Summary collapse
Methods inherited from Filter
#filters, filters, #initialize, load, register
Constructor Details
This class inherits a constructor from Alula::Filter
Instance Method Details
#process(content, locale) ⇒ Object
30 31 32 |
# File 'lib/alula/core_ext/filters/smilies.rb', line 30 def process(content, locale) content.gsub(SMILIES_RE, SMILIES) end |