Class: CommitLive::NetrcInteractor
- Inherits:
-
Object
- Object
- CommitLive::NetrcInteractor
- Defined in:
- lib/commit-live/netrc-interactor.rb
Instance Attribute Summary collapse
-
#login ⇒ Object
readonly
Returns the value of attribute login.
-
#netrc ⇒ Object
readonly
Returns the value of attribute netrc.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Instance Method Summary collapse
- #delete!(machine:) ⇒ Object
-
#initialize ⇒ NetrcInteractor
constructor
A new instance of NetrcInteractor.
- #read(machine: 'ga-config') ⇒ Object
- #write(machine: 'ga-config', new_login:, new_password:) ⇒ Object
Constructor Details
#initialize ⇒ NetrcInteractor
Returns a new instance of NetrcInteractor.
7 8 9 |
# File 'lib/commit-live/netrc-interactor.rb', line 7 def initialize end |
Instance Attribute Details
#login ⇒ Object (readonly)
Returns the value of attribute login.
5 6 7 |
# File 'lib/commit-live/netrc-interactor.rb', line 5 def login @login end |
#netrc ⇒ Object (readonly)
Returns the value of attribute netrc.
5 6 7 |
# File 'lib/commit-live/netrc-interactor.rb', line 5 def netrc @netrc end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
5 6 7 |
# File 'lib/commit-live/netrc-interactor.rb', line 5 def password @password end |
Instance Method Details
#delete!(machine:) ⇒ Object
21 22 23 24 25 26 |
# File 'lib/commit-live/netrc-interactor.rb', line 21 def delete!(machine:) @netrc = Netrc.read netrc.delete(machine) netrc.save end |
#read(machine: 'ga-config') ⇒ Object
11 12 13 14 |
# File 'lib/commit-live/netrc-interactor.rb', line 11 def read(machine: 'ga-config') @netrc = Netrc.read @login, @password = netrc[machine] end |
#write(machine: 'ga-config', new_login:, new_password:) ⇒ Object
16 17 18 19 |
# File 'lib/commit-live/netrc-interactor.rb', line 16 def write(machine: 'ga-config', new_login:, new_password:) netrc[machine] = new_login, new_password netrc.save end |