Class: OpenLogCleaner::Say

Inherits:
Message
  • Object
show all
Defined in:
lib/openlogcleaner/say.rb

Instance Attribute Summary

Attributes inherited from Message

#color, #content, #count, #nick

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Message

#is_ooc?

Class Method Details

.from_hash(msg) ⇒ Object



22
23
24
# File 'lib/openlogcleaner/say.rb', line 22

def self.from_hash(msg)
  new(msg[:nick], msg[:text], msg[:color])
end

.from_html(msg) ⇒ Object



15
16
17
18
19
20
# File 'lib/openlogcleaner/say.rb', line 15

def self.from_html(msg)
  nick = msg.at('b').inner_text.sub(/^\(\d+\)\s+/, '')
  color = msg.at('font')[:color]
  text  = msg.at('font').inner_html
  new(nick, text, color)
end

Instance Method Details

#cssObject



7
8
9
# File 'lib/openlogcleaner/say.rb', line 7

def css
  is_ooc? ? 'ooc' : 'say'
end

#styleObject



11
12
13
# File 'lib/openlogcleaner/say.rb', line 11

def style
  color ? "color: #{color};" : nil
end