Class: Financial::PrintTable
- Inherits:
-
Object
- Object
- Financial::PrintTable
- Defined in:
- lib/financial/print_table.rb
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#account_name ⇒ Object
Returns the value of attribute account_name.
-
#final_date ⇒ Object
Returns the value of attribute final_date.
-
#financial_tables ⇒ Object
readonly
Returns the value of attribute financial_tables.
-
#initial_date ⇒ Object
Returns the value of attribute initial_date.
Instance Method Summary collapse
- #from(initial_date_value) ⇒ Object
-
#initialize(name) ⇒ PrintTable
constructor
A new instance of PrintTable.
- #print! ⇒ Object
- #to(final_date_value) ⇒ Object
Constructor Details
#initialize(name) ⇒ PrintTable
Returns a new instance of PrintTable.
6 7 8 9 10 11 12 13 |
# File 'lib/financial/print_table.rb', line 6 def initialize(name) current_date = Date.today @account_name = name @account = Financial.account_manager.find_account(account_name) @initial_date = current_date @final_date = current_date @financial_tables = [] end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
3 4 5 |
# File 'lib/financial/print_table.rb', line 3 def account @account end |
#account_name ⇒ Object
Returns the value of attribute account_name.
3 4 5 |
# File 'lib/financial/print_table.rb', line 3 def account_name @account_name end |
#final_date ⇒ Object
Returns the value of attribute final_date.
3 4 5 |
# File 'lib/financial/print_table.rb', line 3 def final_date @final_date end |
#financial_tables ⇒ Object (readonly)
Returns the value of attribute financial_tables.
4 5 6 |
# File 'lib/financial/print_table.rb', line 4 def financial_tables @financial_tables end |
#initial_date ⇒ Object
Returns the value of attribute initial_date.
3 4 5 |
# File 'lib/financial/print_table.rb', line 3 def initial_date @initial_date end |
Instance Method Details
#from(initial_date_value) ⇒ Object
15 16 17 18 |
# File 'lib/financial/print_table.rb', line 15 def from(initial_date_value) @initial_date = Financial::FinancialDate.new(initial_date_value).date self end |
#print! ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'lib/financial/print_table.rb', line 25 def print! @financial_tables = @account.collect{|account_instance| FinancialTable.new(account_instance, self)} @financial_tables.each do |financial_table| puts financial_table.header puts financial_table.to_s puts end end |
#to(final_date_value) ⇒ Object
20 21 22 23 |
# File 'lib/financial/print_table.rb', line 20 def to(final_date_value) @final_date = Financial::FinancialDate.new(final_date_value).date self end |