Class: LearnTest::NetrcInteractor
- Inherits:
-
Object
- Object
- LearnTest::NetrcInteractor
- Defined in:
- lib/learn_test/netrc_interactor.rb
Instance Attribute Summary collapse
-
#machine ⇒ Object
readonly
Returns the value of attribute machine.
-
#netrc ⇒ Object
readonly
Returns the value of attribute netrc.
-
#user_id ⇒ Object
readonly
Returns the value of attribute user_id.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(machine: 'flatiron-push') ⇒ NetrcInteractor
constructor
A new instance of NetrcInteractor.
- #write(username, user_id) ⇒ Object
Constructor Details
#initialize(machine: 'flatiron-push') ⇒ NetrcInteractor
Returns a new instance of NetrcInteractor.
7 8 9 10 11 |
# File 'lib/learn_test/netrc_interactor.rb', line 7 def initialize(machine: 'flatiron-push') @machine = machine @netrc = Netrc.read @username, @user_id = netrc[machine] end |
Instance Attribute Details
#machine ⇒ Object (readonly)
Returns the value of attribute machine.
5 6 7 |
# File 'lib/learn_test/netrc_interactor.rb', line 5 def machine @machine end |
#netrc ⇒ Object (readonly)
Returns the value of attribute netrc.
5 6 7 |
# File 'lib/learn_test/netrc_interactor.rb', line 5 def netrc @netrc end |
#user_id ⇒ Object (readonly)
Returns the value of attribute user_id.
5 6 7 |
# File 'lib/learn_test/netrc_interactor.rb', line 5 def user_id @user_id end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/learn_test/netrc_interactor.rb', line 5 def username @username end |
Instance Method Details
#write(username, user_id) ⇒ Object
13 14 15 16 |
# File 'lib/learn_test/netrc_interactor.rb', line 13 def write(username, user_id) netrc[machine] = username, user_id netrc.save end |