Class: Financial::Deposit

Inherits:
Cost
  • Object
show all
Defined in:
lib/financial/deposit.rb

Instance Attribute Summary collapse

Attributes inherited from Cost

#date, #method_name

Instance Method Summary collapse

Methods inherited from Cost

#+, #==, #format_value, #in_date

Constructor Details

#initialize(value, _account_name) ⇒ Deposit

Returns a new instance of Deposit.



6
7
8
9
10
11
12
# File 'lib/financial/deposit.rb', line 6

def initialize(value, )
  @value = value
  @date = Date.today
  @account_to_deposit = :anonymous
  @account_name = 
  deposit_name!
end

Instance Attribute Details

#account_nameObject (readonly)

Returns the value of attribute account_name.



4
5
6
# File 'lib/financial/deposit.rb', line 4

def 
  @account_name
end

#account_to_depositObject (readonly)

Returns the value of attribute account_to_deposit.



4
5
6
# File 'lib/financial/deposit.rb', line 4

def 
  @account_to_deposit
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/financial/deposit.rb', line 3

def name
  @name
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/financial/deposit.rb', line 3

def value
  @value
end

Instance Method Details

#deposit_name!Object



20
21
22
# File 'lib/financial/deposit.rb', line 20

def deposit_name!
  @name = "#{Financial.locale.deposit_name}: #{@account_to_deposit}"
end

#in_account(account_name) ⇒ Object



14
15
16
17
18
# File 'lib/financial/deposit.rb', line 14

def ()
  @account_to_deposit = 
  deposit_name!
  self
end

#is_a_received_deposit?(account) ⇒ Boolean

Return true if is a received deposit

Returns:

  • (Boolean)


26
27
28
# File 'lib/financial/deposit.rb', line 26

def is_a_received_deposit?()
  (not .deposits.include?(self)) and (.name.equal?())
end