Class: SSHConfig::Hosts

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Hosts

Returns a new instance of Hosts.



5
6
7
8
# File 'lib/hosts.rb', line 5

def initialize(&block)
  @hosts = []
  self.instance_eval(&block)
end

Instance Attribute Details

#hostsObject (readonly)

Returns the value of attribute hosts.



3
4
5
# File 'lib/hosts.rb', line 3

def hosts
  @hosts
end

Instance Method Details

#host(name, &blk) ⇒ Object



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

def host(name, &blk)
  @hosts << Host.new(name, &blk)
end

#merge(morehosts) ⇒ Object



10
11
12
# File 'lib/hosts.rb', line 10

def merge(morehosts)
  @hosts += morehosts.hosts
end

#to_sObject



18
19
20
# File 'lib/hosts.rb', line 18

def to_s
  @hosts.map(&:to_s).join("\n")
end