Class: Tmux::Widget Abstract
- Inherits:
-
Object
- Object
- Tmux::Widget
- 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
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#can_display? ⇒ Boolean
True if
@field
is notnil
and@max_length
is > 0. -
#display
Displays the widget if
@field
is notnil
. -
#initialize ⇒ Widget
constructor
A new instance of Widget.
Constructor Details
#initialize ⇒ Widget
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
#field ⇒ 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.
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 |