Class: ITerm2::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/iterm2/session.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, id:, window_id: nil, tab_id: nil, title: nil) ⇒ Session

Returns a new instance of Session.



7
8
9
10
11
12
13
# File 'lib/iterm2/session.rb', line 7

def initialize(client:, id:, window_id: nil, tab_id: nil, title: nil)
  @client = client
  @id = id
  @window_id = window_id
  @tab_id = tab_id
  @title = title
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/iterm2/session.rb', line 5

def client
  @client
end

#idObject (readonly)

Returns the value of attribute id.



5
6
7
# File 'lib/iterm2/session.rb', line 5

def id
  @id
end

#tab_idObject (readonly)

Returns the value of attribute tab_id.



5
6
7
# File 'lib/iterm2/session.rb', line 5

def tab_id
  @tab_id
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/iterm2/session.rb', line 5

def title
  @title
end

#window_idObject (readonly)

Returns the value of attribute window_id.



5
6
7
# File 'lib/iterm2/session.rb', line 5

def window_id
  @window_id
end

Instance Method Details

#activate(select_tab: true, order_window_front: true) ⇒ Object



15
16
17
# File 'lib/iterm2/session.rb', line 15

def activate(select_tab: true, order_window_front: true)
  client.activate_session(id, select_tab: select_tab, order_window_front: order_window_front)
end

#get_variable(name) ⇒ Object



31
32
33
# File 'lib/iterm2/session.rb', line 31

def get_variable(name)
  client.get_variable(name, session_id: id)
end

#infoObject



27
28
29
# File 'lib/iterm2/session.rb', line 27

def info
  client.session_info(id)
end

#read_screen(trailing_lines: nil) ⇒ Object



23
24
25
# File 'lib/iterm2/session.rb', line 23

def read_screen(trailing_lines: nil)
  client.read_screen(id, trailing_lines: trailing_lines)
end

#send_text(text, suppress_broadcast: false) ⇒ Object



19
20
21
# File 'lib/iterm2/session.rb', line 19

def send_text(text, suppress_broadcast: false)
  client.send_text(id, text, suppress_broadcast: suppress_broadcast)
end

#to_hObject



35
36
37
38
39
40
41
42
# File 'lib/iterm2/session.rb', line 35

def to_h
  {
    window_id: window_id,
    tab_id: tab_id,
    session_id: id,
    title: title
  }
end