Sha256: 5ad7108b0c35a219d723720e8a9da7f3d5eca66c066dd2cfbeacf3512156721f
Contents?: true
Size: 997 Bytes
Versions: 1
Compression:
Stored size: 997 Bytes
Contents
require "subtle/subtlext" module Dominikh # @abstract Subclass and override {#render} to implement a dynamic # icon, e.g. a graph. # @see http://rdoc.subforge.org/subtle/classes/Subtlext/Icon.html class DynamicIcon < Subtlext::Icon attr_reader :color def initialize(width, height) super(width, height) @color = nil end def color=(val) case val when Subtlext::Color @color = val when NilClass @color = nil else @color = Subtlext::Color.new(val.to_s) end end # return [String] def to_str s = super if color return color + s + Subtlext::Subtle.colors[:fg_sublets].to_s else return s end end alias_method :to_s, :to_str def +(other) self.to_s + other end # Draws the icon. Redefine this in subclasses to define custom # drawing routines. # # @return [void] def render clear end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
subtle-dynamic_icon-0.0.3 | lib/subtle/dominikh/dynamic_icon.rb |