Class: SshConfig::Loader

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

Overview

For loading an ssh_config(5) file.

Instance Method Summary collapse

Instance Method Details

#parse(str) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ssh_config/loader.rb', line 7

def parse(str)
  pr = ParseRun.new

  str
    .to_str
    .split(/[\n\r]+/)
    .each do |line|

      pr.parse_host(Regexp.last_match(1)) if line =~ /^\s*Host\s+(.*)/
    end

  pr.results
end