Class: Weechat::Color

Inherits:
Object
  • 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.



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

def initialize(name)
  @name = name
end

Instance Attribute Details

#colorObject (readonly) Also known as: to_s, to_str

Returns the value of attribute color.



17
18
19
# File 'lib/weechat/color.rb', line 17

def color
  @color
end

#nameObject (readonly)

Parameters:

  • name (String)

    Name of the color



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

def name
  @name
end

Class Method Details

.const_missing(c) ⇒ Object



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

def self.const_missing(c)
  self.new(c.to_s.downcase)
end

.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



32
33
34
# File 'lib/weechat/color.rb', line 32

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

#to_weechat_configObject



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

def to_weechat_config
  @name
end