Class: Terminal::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/terminal-multiplexer/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session_name, window_name, command) ⇒ Session

Create the session



10
11
12
13
14
15
16
17
# File 'lib/terminal-multiplexer/session.rb', line 10

def initialize(session_name, window_name, command)

  @session_name = session_name
  @window_name = window_name
  @command = command
  @windows = []
  @active_window = 1
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/terminal-multiplexer/session.rb', line 3

def command
  @command
end

#session_nameObject (readonly)

Returns the value of attribute session_name.



3
4
5
# File 'lib/terminal-multiplexer/session.rb', line 3

def session_name
  @session_name
end

#window_nameObject (readonly)

Returns the value of attribute window_name.



3
4
5
# File 'lib/terminal-multiplexer/session.rb', line 3

def window_name
  @window_name
end

Instance Method Details

#active_window(num) ⇒ Object

Set the active window in that session



22
23
24
# File 'lib/terminal-multiplexer/session.rb', line 22

def active_window(num)
  @active_window=num
end

#add_window(window) ⇒ Object

Add a window to the session



65
66
67
# File 'lib/terminal-multiplexer/session.rb', line 65

def add_window(window)
  @windows << window
end

#plainObject

Build the whole session string for tmux



28
29
30
31
32
33
# File 'lib/terminal-multiplexer/session.rb', line 28

def plain
  w_defs ||= build_window_string
  s_opts ||= build_session_options

  "new-session #{s_opts} #{command}\\;#{w_defs}"
end