aboutsummaryrefslogtreecommitdiff
path: root/lib/hosts.rb
diff options
context:
space:
mode:
authorNat Lasseter <user@4574.co.uk>2017-01-19 10:54:32 +0000
committerNat Lasseter <user@4574.co.uk>2017-01-19 10:54:32 +0000
commit07a17b442d7d7a397d076babfaa29fd2620921d7 (patch)
tree03d9095590bfe16b15d11b944b527c6d43b49e41 /lib/hosts.rb
Initial commit
Diffstat (limited to 'lib/hosts.rb')
-rw-r--r--lib/hosts.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/hosts.rb b/lib/hosts.rb
new file mode 100644
index 0000000..1a0fc27
--- /dev/null
+++ b/lib/hosts.rb
@@ -0,0 +1,22 @@
+module SSHConfig
+ class Hosts
+ attr_reader :hosts
+
+ def initialize(&block)
+ @hosts = []
+ self.instance_eval(&block)
+ end
+
+ def merge(morehosts)
+ @hosts += morehosts.hosts
+ end
+
+ def host(name)
+ @hosts << Host.new(name, &Proc.new)
+ end
+
+ def to_s
+ @hosts.map(&:to_s).join("\n")
+ end
+ end
+end