Class: Tmuxinator::Pane
- Inherits:
-
Object
- Object
- Tmuxinator::Pane
- Defined in:
- lib/tmuxinator/pane.rb
Instance Attribute Summary collapse
-
#commands ⇒ Object
readonly
Returns the value of attribute commands.
-
#index ⇒ Object
readonly
Returns the value of attribute index.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
-
#tab ⇒ Object
readonly
Returns the value of attribute tab.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(index, project, tab, *commands, title: nil) ⇒ Pane
constructor
A new instance of Pane.
- #last? ⇒ Boolean
- #name ⇒ Object
- #pane_index ⇒ Object
- #tmux_main_command(command) ⇒ Object
- #tmux_pre_command ⇒ Object
- #tmux_pre_window_command ⇒ Object
- #tmux_set_title ⇒ Object
- #tmux_split_command ⇒ Object
- #tmux_window_and_pane_target ⇒ Object
- #window_index ⇒ Object
Constructor Details
#initialize(index, project, tab, *commands, title: nil) ⇒ Pane
Returns a new instance of Pane.
7 8 9 10 11 12 13 |
# File 'lib/tmuxinator/pane.rb', line 7 def initialize(index, project, tab, *commands, title: nil) @commands = commands @index = index @project = project @tab = tab @title = title.to_s.shellescape unless title.nil? end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
5 6 7 |
# File 'lib/tmuxinator/pane.rb', line 5 def commands @commands end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
5 6 7 |
# File 'lib/tmuxinator/pane.rb', line 5 def index @index end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
5 6 7 |
# File 'lib/tmuxinator/pane.rb', line 5 def project @project end |
#tab ⇒ Object (readonly)
Returns the value of attribute tab.
5 6 7 |
# File 'lib/tmuxinator/pane.rb', line 5 def tab @tab end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/tmuxinator/pane.rb', line 5 def title @title end |
Instance Method Details
#last? ⇒ Boolean
60 61 62 |
# File 'lib/tmuxinator/pane.rb', line 60 def last? index == tab.panes.length - 1 end |
#name ⇒ Object
41 42 43 |
# File 'lib/tmuxinator/pane.rb', line 41 def name project.name end |
#pane_index ⇒ Object
49 50 51 |
# File 'lib/tmuxinator/pane.rb', line 49 def pane_index index + tab.project.pane_base_index end |
#tmux_main_command(command) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/tmuxinator/pane.rb', line 27 def tmux_main_command(command) if command _send_target(command.shellescape) else "" end end |
#tmux_pre_command ⇒ Object
19 20 21 |
# File 'lib/tmuxinator/pane.rb', line 19 def tmux_pre_command _send_target(tab.pre.shellescape) if tab.pre end |
#tmux_pre_window_command ⇒ Object
23 24 25 |
# File 'lib/tmuxinator/pane.rb', line 23 def tmux_pre_window_command _send_target(project.pre_window.shellescape) if project.pre_window end |
#tmux_set_title ⇒ Object
35 36 37 38 39 |
# File 'lib/tmuxinator/pane.rb', line 35 def tmux_set_title unless title.nil? _set_title(title) end end |
#tmux_split_command ⇒ Object
53 54 55 56 57 58 |
# File 'lib/tmuxinator/pane.rb', line 53 def tmux_split_command path = if tab.root? "#{Tmuxinator::Config.default_path_option} #{tab.root}" end "#{project.tmux} splitw #{path} -t #{tab.tmux_window_target}" end |
#tmux_window_and_pane_target ⇒ Object
15 16 17 |
# File 'lib/tmuxinator/pane.rb', line 15 def tmux_window_and_pane_target "#{project.name}:#{window_index}.#{pane_index}" end |
#window_index ⇒ Object
45 46 47 |
# File 'lib/tmuxinator/pane.rb', line 45 def window_index tab.index + project.base_index end |