Class: Pair::Session::HostedSession

Inherits:
Pair::Session show all
Defined in:
lib/pair/session/hosted_session.rb

Instance Attribute Summary collapse

Attributes inherited from Pair::Session

#host, #name, #options, #participants, #viewers

Instance Method Summary collapse

Methods inherited from Pair::Session

host

Constructor Details

#initialize(options = {}) ⇒ HostedSession

Returns a new instance of HostedSession.



15
16
17
18
19
20
21
22
23
# File 'lib/pair/session/hosted_session.rb', line 15

def initialize(options = {})
  puts "Hosting session #{"called #{options[:name].inspect} " if options[:name]}..."

  self.name         = options.delete(:name)
  self.viewers      = options.delete(:viewers)      || []
  self.participants = options.delete(:participants) || []

  super(options)
end

Instance Attribute Details

#responseObject

Returns the value of attribute response.



12
13
14
# File 'lib/pair/session/hosted_session.rb', line 12

def response
  @response
end

Instance Method Details

#host_loginObject



48
49
50
# File 'lib/pair/session/hosted_session.rb', line 48

def 
  `whoami`.chomp
end

#start!Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pair/session/hosted_session.rb', line 25

def start!
  if setup
    display_startup_message

    tunnel.open do
      tmux.start
      tmux.attach
    end
  else
    connection_error!
  end

  exit
end

#stop!Object



40
41
42
43
44
45
46
# File 'lib/pair/session/hosted_session.rb', line 40

def stop!
  tmux.stop
  tunnel.close
  cleanup_authorized_keys
rescue
  raise if $-d
end