class Tmux::Widget
@abstract Subclass this class, provide a meaningful display
method and make sure it is being called.
Attributes
field[RW]
@return [Field]
Public Class Methods
new()
click to toggle source
# File lib/tmux/widget.rb, line 18 def initialize @max_length = 0 @field = nil end
Public Instance Methods
can_display?()
click to toggle source
@return [Boolean] True if `@field` is not `nil` and `@max_length` is > 0
# File lib/tmux/widget.rb, line 31 def can_display? true if @field && @max_length > 0 end
display()
click to toggle source
Displays the widget if `@field` is not `nil`.
@api abstract @return [void]
# File lib/tmux/widget.rb, line 27 def display end
field=(new_field)
click to toggle source
# File lib/tmux/widget.rb, line 9 def field=(new_field) @field = new_field if new_field @max_length = new_field.max_length # Cache this to avoid constantly pulling the option else @max_length = 0 end end