Class: Terminal::Session
- Inherits:
-
Object
- Object
- Terminal::Session
- Defined in:
- lib/tmrb/session.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#session_name ⇒ Object
readonly
Returns the value of attribute session_name.
-
#window_name ⇒ Object
readonly
Returns the value of attribute window_name.
Instance Method Summary collapse
-
#active_window(num) ⇒ Integer
Set the active window in that session.
-
#add_window(window) ⇒ Window
Add a window to the session.
-
#initialize(session_name, window_name, command) ⇒ Session
constructor
Create the session.
-
#to_string ⇒ String
Build the whole session string for tmux.
Constructor Details
#initialize(session_name, window_name, command) ⇒ Session
Create the session
10 11 12 13 14 15 16 17 |
# File 'lib/tmrb/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
#command ⇒ Object (readonly)
Returns the value of attribute command.
3 4 5 |
# File 'lib/tmrb/session.rb', line 3 def command @command end |
#session_name ⇒ Object (readonly)
Returns the value of attribute session_name.
3 4 5 |
# File 'lib/tmrb/session.rb', line 3 def session_name @session_name end |
#window_name ⇒ Object (readonly)
Returns the value of attribute window_name.
3 4 5 |
# File 'lib/tmrb/session.rb', line 3 def window_name @window_name end |
Instance Method Details
#active_window(num) ⇒ Integer
Set the active window in that session
23 24 25 |
# File 'lib/tmrb/session.rb', line 23 def active_window(num) @active_window=num end |
#add_window(window) ⇒ Window
Add a window to the session
70 71 72 |
# File 'lib/tmrb/session.rb', line 70 def add_window(window) @windows << window end |
#to_string ⇒ String
Build the whole session string for tmux
30 31 32 33 34 35 |
# File 'lib/tmrb/session.rb', line 30 def to_string w_defs ||= build_window_string s_opts ||= %Q{new-session #{s_opts} "#{command}"\\;#{w_defs}} end |