Class: Automux::Core::Tmux::Window
- Includes:
- Support::HooksHelper, Support::OptionsHelper
- Defined in:
- lib/automux/core/tmux/window.rb
Instance Attribute Summary collapse
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #change_root_command ⇒ Object
- #get_binding ⇒ Object
- #has_panes? ⇒ Boolean
-
#initialize(session, data) ⇒ Window
constructor
A new instance of Window.
- #layout ⇒ Object
- #name ⇒ Object
- #opted_in? ⇒ Boolean
- #set_option(option) ⇒ Object
- #setup ⇒ Object
- #update_index ⇒ Object
Methods included from Support::HooksHelper
Methods included from Support::CustomAccessors
Constructor Details
#initialize(session, data) ⇒ Window
Returns a new instance of Window.
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/automux/core/tmux/window.rb', line 12 def initialize(session, data) @session = session @data = data @opt = data['opt'] @index = data['index'] @root = data['root'] @data_hooks = data['hooks'] || [] @hooks = [] @data_options = data['options'] || [] @options = [] @panes = [] end |
Instance Attribute Details
#index ⇒ Object (readonly)
Returns the value of attribute index.
8 9 10 |
# File 'lib/automux/core/tmux/window.rb', line 8 def index @index end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
8 9 10 |
# File 'lib/automux/core/tmux/window.rb', line 8 def root @root end |
Instance Method Details
#change_root_command ⇒ Object
57 58 59 |
# File 'lib/automux/core/tmux/window.rb', line 57 def change_root_command %[cd #{ root }] end |
#get_binding ⇒ Object
61 62 63 |
# File 'lib/automux/core/tmux/window.rb', line 61 def get_binding binding end |
#has_panes? ⇒ Boolean
39 40 41 |
# File 'lib/automux/core/tmux/window.rb', line 39 def has_panes? !@panes.nil? end |
#layout ⇒ Object
43 44 45 |
# File 'lib/automux/core/tmux/window.rb', line 43 def layout data['layout'] end |
#name ⇒ Object
29 30 31 |
# File 'lib/automux/core/tmux/window.rb', line 29 def name data['name'] end |
#opted_in? ⇒ Boolean
51 52 53 54 55 |
# File 'lib/automux/core/tmux/window.rb', line 51 def opted_in? return true if @opt.nil? @opt end |
#set_option(option) ⇒ Object
25 26 27 |
# File 'lib/automux/core/tmux/window.rb', line 25 def set_option(option) %[tmux set-window-option -t #{ session.name }:#{ index } #{ option.name } '#{ option.value }'] end |
#setup ⇒ Object
33 34 35 36 37 |
# File 'lib/automux/core/tmux/window.rb', line 33 def setup setup_panes setup_hooks end |
#update_index ⇒ Object
47 48 49 |
# File 'lib/automux/core/tmux/window.rb', line 47 def update_index @index ||= session.next_available_window_index end |