Module: Geostats::Utils
- Defined in:
- lib/geostats/utils.rb
Constant Summary collapse
- SMILIES_URLS =
%w( http://www.geocaching.com/images/icons/icon_smile.gif http://www.geocaching.com/images/icons/icon_smile_big.gif http://www.geocaching.com/images/icons/icon_smile_cool.gif http://www.geocaching.com/images/icons/icon_smile_blush.gif http://www.geocaching.com/images/icons/icon_smile_tongue.gif http://www.geocaching.com/images/icons/icon_smile_evil.gif http://www.geocaching.com/images/icons/icon_smile_wink.gif http://www.geocaching.com/images/icons/icon_smile_clown.gif http://www.geocaching.com/images/icons/icon_smile_blackeye.gif http://www.geocaching.com/images/icons/icon_smile_8ball.gif http://www.geocaching.com/images/icons/icon_smile_sad.gif http://www.geocaching.com/images/icons/icon_smile_shy.gif http://www.geocaching.com/images/icons/icon_smile_shock.gif http://www.geocaching.com/images/icons/icon_smile_angry.gif http://www.geocaching.com/images/icons/icon_smile_dead.gif http://www.geocaching.com/images/icons/icon_smile_sleepy.gif http://www.geocaching.com/images/icons/icon_smile_kisses.gif http://www.geocaching.com/images/icons/icon_smile_approve.gif http://www.geocaching.com/images/icons/icon_smile_dissapprove.gif http://www.geocaching.com/images/icons/icon_smile_question.gif )
- SMILIES_TEXT =
["[:)]", "[:D]", "[8D]", "[:I]", "[:P]", "[}:)]", "[;)]", "[:O)]", "[B)]", "[8]", "[:(]", "[8)]", "[:O]", "[:(!]", "[xx(]", "[|)]", "[:*]", "[^]", "[V]", "[?]"]
Class Method Summary collapse
Class Method Details
.replace_smilie_img_tags(str) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/geostats/utils.rb', line 34 def self.(str) str.gsub(/<img src='(.*?)' border=0 align=middle>/) do |match| if index = SMILIES_URLS.index($1) SMILIES_TEXT[index] end end end |
.unescape(str) ⇒ Object
30 31 32 |
# File 'lib/geostats/utils.rb', line 30 def self.unescape(str) CGI.unescapeHTML(str.gsub(/&#(\d{3});/) { [$1.to_i].pack("U") }) end |