Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ash/master #75

Open
wants to merge 3 commits into
base: ash/master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions bank_account_wave2a.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'csv'
require 'pry'

module Bank
class Account
Expand Down Expand Up @@ -40,16 +41,24 @@ def deposit (deposit_amount)
def self.all

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On lines 29-31 above, since you have an instance variable called balance and an attr_accessor for that instance variable on line 6, this method is not doing anything additional and can be removed.

#returns a collection of Account instances representing all of the Accounts in CSV
account_csv = CSV.read("./support/accounts.csv")
account_array= []
account_array= []
account_csv.each do |row|
account =Bank::Account.new(row[0],row[1].to_i,row[2])
account_array.push(account)
end
account =Bank::Account.new(row[0],row[1].to_i,row[2])
account_array.push(account)
end

return account_array
end

def self.find(id)
self.find_all {|account| account.id == id}
all_accounts = Account.all
all_accounts.each do |account|
if id == account.id
return account
end
end

end

end
end