Class: Dominikh::DynamicIcon Abstract

Inherits:
Subtlext::Icon
  • Object
show all
Defined in:
lib/subtle/dominikh/dynamic_icon.rb

Overview

This class is abstract.

Subclass and override #render to implement a dynamic

icon, e.g. a graph.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ DynamicIcon

Returns a new instance of DynamicIcon.



9
10
11
12
# File 'lib/subtle/dominikh/dynamic_icon.rb', line 9

def initialize(width, height)
  super(width, height)
  @color               = nil
end

Instance Attribute Details

#colorObject

Returns the value of attribute color.



7
8
9
# File 'lib/subtle/dominikh/dynamic_icon.rb', line 7

def color
  @color
end

Instance Method Details

#+(other) ⇒ Object



36
37
38
# File 'lib/subtle/dominikh/dynamic_icon.rb', line 36

def +(other)
  self.to_s + other
end

#rendervoid

This method returns an undefined value.

Draws the icon. Redefine this in subclasses to define custom drawing routines.



44
45
46
# File 'lib/subtle/dominikh/dynamic_icon.rb', line 44

def render
  clear
end

#to_strObject Also known as: to_s

return [String]



26
27
28
29
30
31
32
33
# File 'lib/subtle/dominikh/dynamic_icon.rb', line 26

def to_str
  s = super
  if color
    return color + s + Subtlext::Subtle.colors[:fg_sublets].to_s
  else
    return s
  end
end