diff options
author | Nat Lasseter <user@4574.co.uk> | 2017-01-19 10:54:32 +0000 |
---|---|---|
committer | Nat Lasseter <user@4574.co.uk> | 2017-01-19 10:54:32 +0000 |
commit | 07a17b442d7d7a397d076babfaa29fd2620921d7 (patch) | |
tree | 03d9095590bfe16b15d11b944b527c6d43b49e41 /lib/host.rb |
Initial commit
Diffstat (limited to 'lib/host.rb')
-rw-r--r-- | lib/host.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/host.rb b/lib/host.rb new file mode 100644 index 0000000..90c3e2e --- /dev/null +++ b/lib/host.rb @@ -0,0 +1,19 @@ +module SSHConfig + class Host + def initialize(name, &block) + @name = name + @directives = {} + self.instance_eval(&block) + end + + def method_missing(meth, arg) + @directives[meth.capitalize] = arg + end + + def to_s + "Host #{@name}\n" + + @directives.map { |k, v| "\t#{k} #{v}" }.join("\n") + + "\n" + end + end +end |