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.
Instance Method Summary collapse
-
#initialize(index, project, tab, *commands) ⇒ 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_split_command ⇒ Object
- #tmux_window_and_pane_target ⇒ Object
- #window_index ⇒ Object
Constructor Details
#initialize(index, project, tab, *commands) ⇒ Pane
Returns a new instance of Pane.
5 6 7 8 9 10 |
# File 'lib/tmuxinator/pane.rb', line 5 def initialize(index, project, tab, *commands) @commands = commands @index = index @project = project @tab = tab end |
Instance Attribute Details
#commands ⇒ Object (readonly)
Returns the value of attribute commands.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def commands @commands end |
#index ⇒ Object (readonly)
Returns the value of attribute index.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def index @index end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def project @project end |
#tab ⇒ Object (readonly)
Returns the value of attribute tab.
3 4 5 |
# File 'lib/tmuxinator/pane.rb', line 3 def tab @tab end |
Instance Method Details
#last? ⇒ Boolean
51 52 53 |
# File 'lib/tmuxinator/pane.rb', line 51 def last? index == tab.panes.length - 1 end |
#name ⇒ Object
32 33 34 |
# File 'lib/tmuxinator/pane.rb', line 32 def name project.name end |
#pane_index ⇒ Object
40 41 42 |
# File 'lib/tmuxinator/pane.rb', line 40 def pane_index index + tab.project.pane_base_index end |
#tmux_main_command(command) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/tmuxinator/pane.rb', line 24 def tmux_main_command(command) if command _send_target(command.shellescape) else "" end end |
#tmux_pre_command ⇒ Object
16 17 18 |
# File 'lib/tmuxinator/pane.rb', line 16 def tmux_pre_command _send_target(tab.pre.shellescape) if tab.pre end |
#tmux_pre_window_command ⇒ Object
20 21 22 |
# File 'lib/tmuxinator/pane.rb', line 20 def tmux_pre_window_command _send_target(project.pre_window.shellescape) if project.pre_window end |
#tmux_split_command ⇒ Object
44 45 46 47 48 49 |
# File 'lib/tmuxinator/pane.rb', line 44 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
12 13 14 |
# File 'lib/tmuxinator/pane.rb', line 12 def tmux_window_and_pane_target "#{project.name}:#{window_index}.#{pane_index}" end |
#window_index ⇒ Object
36 37 38 |
# File 'lib/tmuxinator/pane.rb', line 36 def window_index tab.index + project.base_index end |