class SeleniumGridConsoleParser::Nodes::GridNode

Attributes

configuration[R]
remoteHost[R]

Public Class Methods

new(configuration) click to toggle source
# File lib/nodes/grid_node.rb, line 8
def initialize(configuration)
  @remoteHost = configuration["remoteHost"]
  @configuration = configuration.delete_if {|key, value| key == "remoteHost"}
  @down = false
  @data = GridNodeData.new(self)
end

Public Instance Methods

down?() click to toggle source
# File lib/nodes/grid_node.rb, line 29
def down?
  begin
    @data.sessions
  rescue NodeDownException
    @down = true
    return true
  end
  @down = false
  return false
end
free?() click to toggle source
# File lib/nodes/grid_node.rb, line 19
def free?
  if down?
    @free = false
  else
    sessions = @data.sessions
    @free = sessions["value"].size == 0 ? true : false
  end
  @free
end
name() click to toggle source
# File lib/nodes/grid_node.rb, line 15
def name
  @configuration["capabilities"]["applicationName"]
end
to_hash() click to toggle source
# File lib/nodes/grid_node.rb, line 40
def to_hash
  free?
  grid_node_hash = self.instance_variables.each_with_object({}) { |var, hash| hash[var.to_s.delete("@")] = self.instance_variable_get(var) }
  grid_node_hash.delete("data")
  grid_node_hash
end