Class: Net::SSH::Multi::Subsession

### Home Classes Methods

### In Files

- lib/net/ssh/multi/subsession.rb

### Parent

Object

### Methods

- ::new
- #first
- #slice

### Included Modules

- Net::SSH::Multi::SessionActions

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Net
- Net::SSH
- Net::SSH::Multi
- Net::SSH::Multi::Channel
- Net::SSH::Multi::ChannelProxy
- Net::SSH::Multi::DynamicServer
- Net::SSH::Multi::PendingConnection
- Net::SSH::Multi::Server
- Net::SSH::Multi::ServerList
- Net::SSH::Multi::Session
- Net::SSH::Multi::SessionActions
- Net::SSH::Multi::Subsession
- Net::SSH::Multi::Version

No matching classes.

# Net::SSH::Multi::Subsession

A trivial class for representing a subset of servers. It is used internally for restricting operations to a subset of all defined servers.

    subsession = session.with(:app)
    subsession.exec("hostname")

### Attributes

master[R]

The master session that spawned this subsession.

servers[R]

The list of servers that this subsession can operate on.

### Public Class Methods

new(master, server_list) click to toggle source

Create a new subsession of the given `master` session, that operates on the given `server_list`.

    # File lib/net/ssh/multi/subsession.rb, line 22
    def initialize(master, server_list)
      @master  = master
      @servers = server_list.uniq
    end

### Public Instance Methods

first() click to toggle source

Returns a new subsession that consists of only the first server in the server list of the current subsession. This is just convenience for slice(0):

    s1 = subsession.first

    # File lib/net/ssh/multi/subsession.rb, line 43
    def first
      slice(0)
    end

slice(*args) click to toggle source

Works as Array#slice, but returns a new subsession consisting of the given slice of servers in this subsession. The new subsession will have the same master session as this subsession does.

    s1 = subsession.slice(0)
    s2 = subsession.slice(3, -1)
    s3 = subsession.slice(1..4)

    # File lib/net/ssh/multi/subsession.rb, line 34
    def slice(*args)
      Subsession.new(master, Array(servers.slice(*args)))
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.