bean_sprout 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4f1cb8b063d609c6b1734ced03dea9ea338bd31f
4
- data.tar.gz: 08c5d0e268e47b4073b41992e865a635cac595e8
3
+ metadata.gz: f0c296f0544c8cc79cd02755c6f56f24707fec21
4
+ data.tar.gz: 4697a8ecd50d231262c809febd4624fe985d814c
5
5
  SHA512:
6
- metadata.gz: cfd89409a85cc59d047363debe7baacdf14e3e7e9020684ae12625c4e0aec9722dbb0656dc9966345dc6fa35a35e04ba95c8ebc3f36aab82c3b4c9ca52941350
7
- data.tar.gz: 141d728280ff6fd755c2e2aca24f56c11baf8e0388976801ab37aafffa80bda7d9ad1c3f59eae826954d09452155f1cc1b6fe1594eee567fd97fee43ee8549ba
6
+ metadata.gz: 29f14e1a8a7e8dcdc68e70e379395859bf63a6dee8aa936eb8ed611a605345c5db59d6593b526516cbf8803a7c7b6c4ffc2e8c5bd2ace07f93994a5954a73225
7
+ data.tar.gz: 8fee22de7310d99c6e9e15ab64add0a3093fabb116a59eb0403007262f6ed5a91a8c31ad6fb6fb759313b3e79e426231e066ab22bc43564a596b65c95ae2b24b
@@ -13,7 +13,9 @@ module BeanSprout
13
13
  @beans = SparseArray.new
14
14
  @sprout_bunches = SparseArray.new
15
15
  @sprouts = SparseArray.new
16
- @dummy_accounts = {}
16
+ @forex_accounts = {}
17
+ @income_accounts = {}
18
+ @expense_accounts = {}
17
19
  end
18
20
 
19
21
  def create_account currency, other_data: nil
@@ -54,9 +56,9 @@ module BeanSprout
54
56
 
55
57
  def forex_transfer from_acc, to_acc, from_amount, to_amount, other_data: nil
56
58
  entry0 = create_entry from_acc, -from_amount
57
- entry1 = create_entry (dummy_account from_acc.currency), from_amount
59
+ entry1 = create_entry (forex_account from_acc.currency), from_amount
58
60
  entry2 = create_entry to_acc, to_amount
59
- entry3 = create_entry (dummy_account to_acc.currency), -to_amount
61
+ entry3 = create_entry (forex_account to_acc.currency), -to_amount
60
62
  commit_entries [entry0, entry1, entry2, entry3], other_data
61
63
  end
62
64
 
@@ -92,10 +94,20 @@ module BeanSprout
92
94
  end
93
95
  end
94
96
 
95
- def dummy_account currency = nil
97
+ def forex_account currency = nil
96
98
  currency ||= @base_currency
97
- acc = create_account currency, other_data: "This is a dummy account for #{currency}."
98
- @dummy_accounts[currency] ||= acc
99
+ acc = create_account currency, other_data: "This is a forex account for #{currency}."
100
+ @forex_accounts[currency] ||= acc
101
+ end
102
+
103
+ def income_account currency = nil
104
+ currency ||= @base_currency
105
+ @income_accounts[currency] ||= create_account currency, other_data: "This is an income account for #{currency}."
106
+ end
107
+
108
+ def expense_account currency = nil
109
+ currency ||= @base_currency
110
+ @expense_accounts[currency] ||= create_account currency, other_data: "This is an expense account for #{currency}."
99
111
  end
100
112
 
101
113
  private
@@ -1,3 +1,3 @@
1
1
  module BeanSprout
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bean_sprout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liqing Muyi