Class: ClusterBomb::Cluster::Host
- Inherits:
-
Object
- Object
- ClusterBomb::Cluster::Host
- Defined in:
- lib/cluster_bomb/cluster.rb
Instance Attribute Summary collapse
-
#buffer_console ⇒ Object
Returns the value of attribute buffer_console.
-
#buffer_stderr ⇒ Object
Returns the value of attribute buffer_stderr.
-
#buffer_stdout ⇒ Object
Returns the value of attribute buffer_stdout.
-
#connect_failed ⇒ Object
Returns the value of attribute connect_failed.
-
#connected ⇒ Object
Returns the value of attribute connected.
-
#data ⇒ Object
Returns the value of attribute data.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #clear! ⇒ Object
- #console ⇒ Object
-
#initialize(name, cluster) ⇒ Host
constructor
A new instance of Host.
-
#match(rex, default = nil) ⇒ Object
match stdout, returning arrays.
- #nickname ⇒ Object
- #stderr ⇒ Object
- #stdout ⇒ Object
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_console ⇒ Object
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_stderr ⇒ Object
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_stdout ⇒ Object
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_failed ⇒ Object
Returns the value of attribute connect_failed.
17 18 19 |
# File 'lib/cluster_bomb/cluster.rb', line 17 def connect_failed @connect_failed end |
#connected ⇒ Object
Returns the value of attribute connected.
16 17 18 |
# File 'lib/cluster_bomb/cluster.rb', line 16 def connected @connected end |
#data ⇒ Object
Returns the value of attribute data.
15 16 17 |
# File 'lib/cluster_bomb/cluster.rb', line 15 def data @data end |
#exception ⇒ Object
Returns the value of attribute exception.
14 15 16 |
# File 'lib/cluster_bomb/cluster.rb', line 14 def exception @exception end |
#name ⇒ Object
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 |
#console ⇒ Object
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 |
#nickname ⇒ Object
27 28 29 |
# File 'lib/cluster_bomb/cluster.rb', line 27 def nickname @cluster.nicknames[self.name] end |
#stderr ⇒ Object
33 34 35 |
# File 'lib/cluster_bomb/cluster.rb', line 33 def stderr buffer_stderr.join('') end |
#stdout ⇒ Object
30 31 32 |
# File 'lib/cluster_bomb/cluster.rb', line 30 def stdout buffer_stdout.join('') end |