Class: SSHConfig::Host
- Inherits:
-
Object
- Object
- SSHConfig::Host
- Defined in:
- lib/host.rb
Instance Method Summary collapse
-
#initialize(name, &block) ⇒ Host
constructor
A new instance of Host.
- #method_missing(meth, arg) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Host
Returns a new instance of Host.
3 4 5 6 7 |
# File 'lib/host.rb', line 3 def initialize(name, &block) @name = name @directives = {} self.instance_eval(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, arg) ⇒ Object
9 10 11 |
# File 'lib/host.rb', line 9 def method_missing(meth, arg) @directives[meth.capitalize] = arg end |
Instance Method Details
#to_s ⇒ Object
13 14 15 16 17 |
# File 'lib/host.rb', line 13 def to_s "Host #{@name}\n" + @directives.map { |k, v| "\t#{k} #{v}" }.join("\n") + "\n" end |