Class: TmRb::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/tmrb/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = 'tab', command = 'zsh') ⇒ Window

Create a tmux window

Parameters:

  • name (String) (defaults to: 'tab')

    the name of the window

  • command (String) (defaults to: 'zsh')

    the command executed in the window



9
10
11
12
13
14
15
16
17
# File 'lib/tmrb/window.rb', line 9

def initialize(name = 'tab', command = 'zsh')

  name = 'tab' if name == nil  or name == ''
  command = 'zsh' if command == nil  or command == ''

  @name = name
  @command = command
  @options = []
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/tmrb/window.rb', line 3

def command
  @command
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/tmrb/window.rb', line 3

def name
  @name
end

Instance Method Details

#to_stringString

Return the tmux string for the window

Returns:

  • (String)

    window declaration



22
23
24
25
# File 'lib/tmrb/window.rb', line 22

def to_string
  @options.push %Q{-n "#{name}"}
  %Q{new-window #{@options.join(' ')} "#{command}"\\;}
end