Class: Pair::Session::Tmux
- Inherits:
-
Object
- Object
- Pair::Session::Tmux
- Defined in:
- lib/pair/session/tmux.rb
Instance Attribute Summary collapse
-
#session_name ⇒ Object
readonly
Returns the value of attribute session_name.
Instance Method Summary collapse
- #attach(read_only = false) ⇒ Object
- #attach_command(read_only = false) ⇒ Object
-
#initialize(session_name) ⇒ Tmux
constructor
A new instance of Tmux.
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(session_name) ⇒ Tmux
Returns a new instance of Tmux.
10 11 12 |
# File 'lib/pair/session/tmux.rb', line 10 def initialize(session_name) self.session_name = session_name end |
Instance Attribute Details
#session_name ⇒ Object
Returns the value of attribute session_name.
7 8 9 |
# File 'lib/pair/session/tmux.rb', line 7 def session_name @session_name end |
Instance Method Details
#attach(read_only = false) ⇒ Object
19 20 21 |
# File 'lib/pair/session/tmux.rb', line 19 def attach(read_only = false) system(*attach_command(read_only)) end |
#attach_command(read_only = false) ⇒ Object
28 29 30 31 32 |
# File 'lib/pair/session/tmux.rb', line 28 def attach_command(read_only = false) args = %W[#{tmux} -S #{socket_path} attach] args << " -r" if read_only args end |
#start ⇒ Object
14 15 16 17 |
# File 'lib/pair/session/tmux.rb', line 14 def start args = %W[-S #{socket_path} new-session -d] system tmux, *args end |
#stop ⇒ Object
23 24 25 26 |
# File 'lib/pair/session/tmux.rb', line 23 def stop `lsof -t #{socket_path}/ 2>/dev/null | xargs kill -9` FileUtils.rm_f(socket_path) end |