Class: NetrcReader::Machine

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, config) ⇒ Machine



44
45
46
47
# File 'lib/netrc_reader.rb', line 44

def initialize(name, config)
  @name = name
  @config = config
end

Instance Attribute Details

#nameObject (readonly) Also known as: machine

Returns the value of attribute name.



42
43
44
# File 'lib/netrc_reader.rb', line 42

def name
  @name
end

Instance Method Details

#credsObject



59
60
61
62
63
# File 'lib/netrc_reader.rb', line 59

def creds
  @config.match(
    /machine (?<machine>.*) login (?<login>.*) password (?<password>.*)$/
  )
end

#ftp_open_optsObject



65
66
67
# File 'lib/netrc_reader.rb', line 65

def ftp_open_opts
  [machine, , password]
end

#loginObject



55
56
57
# File 'lib/netrc_reader.rb', line 55

def 
  creds[:login] if creds.respond_to?(:[])
end

#passwordObject



51
52
53
# File 'lib/netrc_reader.rb', line 51

def password
  creds[:password] if creds.respond_to?(:[])
end