Class: SSHConfig::Host

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

Instance Method Summary collapse

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_sObject



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