Class: Dinero::Account

Inherits:
Object
  • Object
show all
Defined in:
lib/dinero/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(account_type, name, number, balance, available) ⇒ Account

Returns a new instance of Account.



6
7
8
9
10
11
12
13
14
15
# File 'lib/dinero/account.rb', line 6

def initialize , name, number, balance, available
  @account_type = 
  name_parts = name.split("\n")
  @name = name_parts.shift
  @name_other = name_parts.join("\n")
  @number = number
  @balance = balance.scan(NUMERIC_REGEXP).join.to_f
  @available = available.scan(NUMERIC_REGEXP).join.to_f
  @balance *= -1 if @account_type == :loan
end

Instance Attribute Details

#account_typeObject (readonly)

Returns the value of attribute account_type.



5
6
7
# File 'lib/dinero/account.rb', line 5

def 
  @account_type
end

#availableObject (readonly)

Returns the value of attribute available.



5
6
7
# File 'lib/dinero/account.rb', line 5

def available
  @available
end

#balanceObject (readonly)

Returns the value of attribute balance.



5
6
7
# File 'lib/dinero/account.rb', line 5

def balance
  @balance
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/dinero/account.rb', line 5

def name
  @name
end

#name_otherObject (readonly)

Returns the value of attribute name_other.



5
6
7
# File 'lib/dinero/account.rb', line 5

def name_other
  @name_other
end

#numberObject (readonly)

Returns the value of attribute number.



5
6
7
# File 'lib/dinero/account.rb', line 5

def number
  @number
end