Class: SSHConfig::Hosts
- Inherits:
-
Object
- Object
- SSHConfig::Hosts
- Defined in:
- lib/hosts.rb
Instance Attribute Summary collapse
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
Instance Method Summary collapse
- #host(name, &blk) ⇒ Object
-
#initialize(&block) ⇒ Hosts
constructor
A new instance of Hosts.
- #merge(morehosts) ⇒ Object
- #to_s ⇒ Object
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
#hosts ⇒ Object (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_s ⇒ Object
18 19 20 |
# File 'lib/hosts.rb', line 18 def to_s @hosts.map(&:to_s).join("\n") end |