Class: Weechat::Color

Inherits:
Object show all
Defined in:
lib/weechat/color.rb

Overview

This class represents a Weechat color.

It is created from a color name and saves that name and the color representation.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Color

Returns a new instance of Color.



14
15
16
17
# File 'lib/weechat/color.rb', line 14

def initialize(name)
  @name = name
  @color = Weechat.color(name)
end

Instance Attribute Details

#colorObject (readonly)

Returns the value of attribute color.



13
14
15
# File 'lib/weechat/color.rb', line 13

def color
  @color
end

#nameObject (readonly)

Parameters:

  • name (String)

    Name of the color



12
13
14
# File 'lib/weechat/color.rb', line 12

def name
  @name
end

Class Method Details

.from_weechat_config(v) ⇒ Object



7
8
9
# File 'lib/weechat/color.rb', line 7

def self.from_weechat_config(v)
  new(v)
end

Instance Method Details

#==(other) ⇒ Object



28
29
30
# File 'lib/weechat/color.rb', line 28

def ==(other)
  @name == other.name
end

#to_sObject Also known as: to_str



19
20
21
# File 'lib/weechat/color.rb', line 19

def to_s
  @color
end

#to_weechat_configObject



24
25
26
# File 'lib/weechat/color.rb', line 24

def to_weechat_config
  @name
end