class SkypeSearch::OutputProcessor
Constants
- EMOTICON_MATCHER
- EMOTICON_REPLACE
Attributes
output[RW]
Public Class Methods
new(output)
click to toggle source
# File lib/skype_search/output_processor.rb, line 9 def initialize output @output = output end
Public Instance Methods
parse()
click to toggle source
# File lib/skype_search/output_processor.rb, line 13 def parse replace_all matches unless matches.nil? self end
Private Instance Methods
colorize(text, color_code=31)
click to toggle source
# File lib/skype_search/output_processor.rb, line 37 def colorize text, color_code=31 "\e[#{color_code}m#{text}\e[0m" end
matches()
click to toggle source
# File lib/skype_search/output_processor.rb, line 21 def matches scan_for_emoticons.map { |emoticon| EMOTICON_MATCHER.match(emoticon) } end
replace(match, symbol)
click to toggle source
# File lib/skype_search/output_processor.rb, line 33 def replace match, symbol @output.gsub!(match.to_s, colorize(symbol)) end
replace_all(matches)
click to toggle source
# File lib/skype_search/output_processor.rb, line 29 def replace_all matches matches.each { |match| replace(match, match[:symbol]) } end
scan_for_emoticons()
click to toggle source
# File lib/skype_search/output_processor.rb, line 25 def scan_for_emoticons @output.scan(EMOTICON_REPLACE) end