Class: ClusterBomb::Cluster::Host

Inherits:
Object
  • Object
show all
Defined in:
lib/cluster_bomb/cluster.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, cluster) ⇒ Host

Returns a new instance of Host.



19
20
21
22
23
24
25
26
# File 'lib/cluster_bomb/cluster.rb', line 19

def initialize(name, cluster)
  self.name=name
  self.clear!
  self.data={}
  self.connected=false
  self.connect_failed=false
  @cluster = cluster
end

Instance Attribute Details

#buffer_consoleObject

Returns the value of attribute buffer_console.



13
14
15
# File 'lib/cluster_bomb/cluster.rb', line 13

def buffer_console
  @buffer_console
end

#buffer_stderrObject

Returns the value of attribute buffer_stderr.



13
14
15
# File 'lib/cluster_bomb/cluster.rb', line 13

def buffer_stderr
  @buffer_stderr
end

#buffer_stdoutObject

Returns the value of attribute buffer_stdout.



13
14
15
# File 'lib/cluster_bomb/cluster.rb', line 13

def buffer_stdout
  @buffer_stdout
end

#connect_failedObject

Returns the value of attribute connect_failed.



17
18
19
# File 'lib/cluster_bomb/cluster.rb', line 17

def connect_failed
  @connect_failed
end

#connectedObject

Returns the value of attribute connected.



16
17
18
# File 'lib/cluster_bomb/cluster.rb', line 16

def connected
  @connected
end

#dataObject

Returns the value of attribute data.



15
16
17
# File 'lib/cluster_bomb/cluster.rb', line 15

def data
  @data
end

#exceptionObject

Returns the value of attribute exception.



14
15
16
# File 'lib/cluster_bomb/cluster.rb', line 14

def exception
  @exception
end

#nameObject

Returns the value of attribute name.



12
13
14
# File 'lib/cluster_bomb/cluster.rb', line 12

def name
  @name
end

Instance Method Details

#clear!Object



39
40
41
42
43
44
# File 'lib/cluster_bomb/cluster.rb', line 39

def clear!
  self.buffer_stderr=[]
  self.buffer_stdout=[]
  self.buffer_console=[]
  self.exception=nil
end

#consoleObject



36
37
38
# File 'lib/cluster_bomb/cluster.rb', line 36

def console
  buffer_console.join('')
end

#match(rex, default = nil) ⇒ Object

match stdout, returning arrays



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/cluster_bomb/cluster.rb', line 46

def match(rex, default=nil)
  m = rex.match self.stdout
  if m
    if m.length > 2
      m[1..-1]
    else
      m[1]
    end
  else
    default
  end
end

#nicknameObject



27
28
29
# File 'lib/cluster_bomb/cluster.rb', line 27

def nickname
  @cluster.nicknames[self.name]
end

#stderrObject



33
34
35
# File 'lib/cluster_bomb/cluster.rb', line 33

def stderr
  buffer_stderr.join('')
end

#stdoutObject



30
31
32
# File 'lib/cluster_bomb/cluster.rb', line 30

def stdout
  buffer_stdout.join('')
end