Class: Tmux::Widget Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/tmux/widget.rb

Overview

This class is abstract.

Subclass this class, provide a meaningful #display method and make sure it is being called.

Direct Known Subclasses

Tmux::Widgets::ProgressBar

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeWidget

Returns a new instance of Widget.



18
19
20
21
# File 'lib/tmux/widget.rb', line 18

def initialize
  @max_length = 0
  @field      = nil
end

Instance Attribute Details

#fieldField

Returns:

  • (Field)


6
7
8
# File 'lib/tmux/widget.rb', line 6

def field
  @field
end

Instance Method Details

#can_display?Boolean

Returns True if @field is not nil and @max_length is > 0.

Returns:

  • (Boolean)

    True if @field is not nil and @max_length is > 0



31
32
33
# File 'lib/tmux/widget.rb', line 31

def can_display?
  true if @field && @max_length > 0
end

#display

This method returns an undefined value.

Displays the widget if @field is not nil.



27
28
# File 'lib/tmux/widget.rb', line 27

def display
end