Class: Ace::Tmux::Models::RuntimeTarget

Inherits:
Object
  • Object
show all
Defined in:
lib/ace/tmux/models/runtime_target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session: nil, window: nil, pane: nil, source:, raw_window_target: nil) ⇒ RuntimeTarget

Returns a new instance of RuntimeTarget.



9
10
11
12
13
14
15
# File 'lib/ace/tmux/models/runtime_target.rb', line 9

def initialize(session: nil, window: nil, pane: nil, source:, raw_window_target: nil)
  @session = presence(session)
  @window = presence(window)
  @pane = presence(pane)
  @source = source.to_s
  @raw_window_target = presence(raw_window_target)
end

Instance Attribute Details

#paneObject (readonly)

Returns the value of attribute pane.



7
8
9
# File 'lib/ace/tmux/models/runtime_target.rb', line 7

def pane
  @pane
end

#sessionObject (readonly)

Returns the value of attribute session.



7
8
9
# File 'lib/ace/tmux/models/runtime_target.rb', line 7

def session
  @session
end

#sourceObject (readonly)

Returns the value of attribute source.



7
8
9
# File 'lib/ace/tmux/models/runtime_target.rb', line 7

def source
  @source
end

#windowObject (readonly)

Returns the value of attribute window.



7
8
9
# File 'lib/ace/tmux/models/runtime_target.rb', line 7

def window
  @window
end

Instance Method Details

#pane_targetObject



28
29
30
31
32
33
34
35
# File 'lib/ace/tmux/models/runtime_target.rb', line 28

def pane_target
  return pane if pane&.start_with?("%")
  return pane if pane&.start_with?("@")
  return pane if pane&.include?(":")
  return nil unless pane && window_target

  "#{window_target}.#{pane}"
end

#session_targetObject



17
18
19
# File 'lib/ace/tmux/models/runtime_target.rb', line 17

def session_target
  session
end

#window_targetObject



21
22
23
24
25
26
# File 'lib/ace/tmux/models/runtime_target.rb', line 21

def window_target
  return @raw_window_target if @raw_window_target
  return nil unless session && window

  "#{session}:#{window}"
end