Class: LearnTest::NetrcInteractor

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNetrcInteractor

Returns a new instance of NetrcInteractor.



7
8
9
10
# File 'lib/learn_test/netrc_interactor.rb', line 7

def initialize
  @netrc = Netrc.read
  @username, @user_id = netrc["flatiron-push"]
end

Instance Attribute Details

#netrcObject (readonly)

Returns the value of attribute netrc.



5
6
7
# File 'lib/learn_test/netrc_interactor.rb', line 5

def netrc
  @netrc
end

#user_idObject (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

#usernameObject (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



12
13
14
15
# File 'lib/learn_test/netrc_interactor.rb', line 12

def write(username, user_id)
  netrc["flatiron-push"] = username, user_id
  netrc.save
end