Class: Bcome::Ssh::Window

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/objects/ssh/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*_params) ⇒ Window

Returns a new instance of Window.



10
11
12
# File 'lib/objects/ssh/window.rb', line 10

def initialize(*_params)
  @lines = []
end

Instance Attribute Details

#linesObject (readonly)

Returns the value of attribute lines.



6
7
8
# File 'lib/objects/ssh/window.rb', line 6

def lines
  @lines
end

Instance Method Details

#add(node, log_line) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/objects/ssh/window.rb', line 14

def add(node, log_line)
  multi_line = log_line =~ /\n/ ? true : false

  @lines << if ::Bcome::Orchestrator.instance.is_multi_node?
              "\n#{node.namespace}".terminal_prompt + "\n#{log_line}"
            else
              log_line
            end

  pop
end

#popObject



26
27
28
# File 'lib/objects/ssh/window.rb', line 26

def pop
  print @lines.pop
end