class TheFox::TermKit::ViewContent

Holds the character for a single Point of a View.

Attributes

background_color[R]
char[RW]
foreground_color[R]
needs_rendering[RW]

This variable is used to detect which of the points has already been rendered by the View.

  • If true View render() will return this instance.

  • If false the content of the View didn't change since the last call of render() and the content has already been used in render().

origin[RW]
view[RW]

Public Class Methods

new(char, view = nil, origin = nil) click to toggle source
# File lib/termkit/view/content_view.rb, line 23
def initialize(char, view = nil, origin = nil)
    @char = char[0]
    @view = view
    @needs_rendering = true
    @origin = origin
    @foreground_color = nil
    @background_color = nil
end

Public Instance Methods

background_color=(background_color) click to toggle source
# File lib/termkit/view/content_view.rb, line 40
def background_color=(background_color)
    if @background_color != background_color
        @background_color = background_color
        
        @needs_rendering = true
    end
end
foreground_color=(foreground_color) click to toggle source
# File lib/termkit/view/content_view.rb, line 32
def foreground_color=(foreground_color)
    if @foreground_color != foreground_color
        @foreground_color = foreground_color
        
        @needs_rendering = true
    end
end
inspect() click to toggle source
# File lib/termkit/view/content_view.rb, line 52
def inspect
    "#<#{self.class.name.split('::').last} c='#{@char}' r?=#{@needs_rendering ? 'Y' : 'N'} v=#{@view} o=#{@origin}>"
end
to_s() click to toggle source
# File lib/termkit/view/content_view.rb, line 48
def to_s
    @char
end