Class: Account
- Inherits:
-
Object
- Object
- Account
- Defined in:
- lib/account.rb
Overview
class Account
Instance Attribute Summary collapse
-
#balance ⇒ Object
Returns the value of attribute balance.
-
#card_blocked ⇒ Object
Returns the value of attribute card_blocked.
-
#card_number ⇒ Object
Returns the value of attribute card_number.
-
#name ⇒ Object
Returns the value of attribute name.
-
#pin ⇒ Object
Returns the value of attribute pin.
-
#transactions ⇒ Object
Returns the value of attribute transactions.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, card_number, pin, balance, card_blocked) ⇒ Account
constructor
A new instance of Account.
Constructor Details
#initialize(name, card_number, pin, balance, card_blocked) ⇒ Account
Returns a new instance of Account.
9 10 11 12 13 14 15 |
# File 'lib/account.rb', line 9 def initialize(name, card_number, pin, balance, card_blocked) @name = name @card_number = card_number @pin = pin @balance = balance @card_blocked = card_blocked end |
Instance Attribute Details
#balance ⇒ Object
Returns the value of attribute balance.
7 8 9 |
# File 'lib/account.rb', line 7 def balance @balance end |
#card_blocked ⇒ Object
Returns the value of attribute card_blocked.
7 8 9 |
# File 'lib/account.rb', line 7 def card_blocked @card_blocked end |
#card_number ⇒ Object
Returns the value of attribute card_number.
7 8 9 |
# File 'lib/account.rb', line 7 def card_number @card_number end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/account.rb', line 7 def name @name end |
#pin ⇒ Object
Returns the value of attribute pin.
7 8 9 |
# File 'lib/account.rb', line 7 def pin @pin end |
#transactions ⇒ Object
Returns the value of attribute transactions.
7 8 9 |
# File 'lib/account.rb', line 7 def transactions @transactions end |
Class Method Details
.find_by_card_number(card_number) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/account.rb', line 17 def self.find_by_card_number(card_number) CSV.table('account.csv').each do |entry| if entry[:card_number] == card_number return new(entry[:name], entry[:card_number], entry[:pin], entry[:balance], entry[:card_blocked]) end end nil end |