Class: NetrcReader::Machine
- Inherits:
-
Object
- Object
- NetrcReader::Machine
- Defined in:
- lib/netrc_reader.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #machine)
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #creds ⇒ Object
- #ftp_open_opts ⇒ Object
-
#initialize(name, config) ⇒ Machine
constructor
A new instance of Machine.
- #login ⇒ Object
- #password ⇒ Object
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
#name ⇒ Object (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
#creds ⇒ Object
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_opts ⇒ Object
65 66 67 |
# File 'lib/netrc_reader.rb', line 65 def ftp_open_opts [machine, login, password] end |
#login ⇒ Object
55 56 57 |
# File 'lib/netrc_reader.rb', line 55 def login creds[:login] if creds.respond_to?(:[]) end |
#password ⇒ Object
51 52 53 |
# File 'lib/netrc_reader.rb', line 51 def password creds[:password] if creds.respond_to?(:[]) end |