ledger_tiller_export 0.1.0 → 0.1.1

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: 307135e8c2caf98e4b2958efc90c4acfa8944ecd
4
- data.tar.gz: 0ad4cbab8a0bc01f6174887393b897c830be8276
3
+ metadata.gz: dca9cd455a804f83b08934969616fd39bd5821c8
4
+ data.tar.gz: 14fe0a7365a1f4245ab95aa3f581782e8c3b4ac0
5
5
  SHA512:
6
- metadata.gz: 5694e282fa1fa7a298d34fbfb2ef8a7bd635c5a2ac2b22121fefd758ab2ec16ae81a5246be8a4032673eaae9ed599a2ba0d554d3ff6ecc0a9b722260ad1100e5
7
- data.tar.gz: 52e45c2a10d3f04de595f2533d414b9373d57643aa23d5dd31beae75d6323dfc0b3699e2f28a8a50e5bc04d2d8e6e060a8f096d133eaaac44df8938abdf3ee1f
6
+ metadata.gz: 6971651ad421854977106cb545a618f5cab00c7fcf090974552f0ca0e77c0765dc65cf12a3074dff3a038633ff0ad605b0ac0159e64daaa39e44ea688cca432f
7
+ data.tar.gz: 75284c5af67a757b5b3d4880fc1ba21538a47cfb0a14ecb46b52a4f9bb4e823f89e0d693fdb6cc511d954afbdb3b86afab4653447549c3b438e96cba3c62a031
data/README.md CHANGED
@@ -91,7 +91,7 @@ class CheckingAccountRule
91
91
  end
92
92
 
93
93
  CHECKING_ACCOUNTS = T.let([
94
- CheckingAccount.new(account: 'Assets:SomeBank:Checking', check_account_prefix: 'Liabilities:Checks:SomeBank),
94
+ CheckingAccount.new(account: 'Assets:SomeBank:Checking', check_account_prefix: 'Liabilities:Checks:SomeBank'),
95
95
  CheckingAccount.new(account: 'Assets:OtherBank:Checking', check_account_prefix: 'Liabilities:Checks:OtherBank'),
96
96
  ], T::Array[CheckingAccount])
97
97
 
@@ -41,8 +41,12 @@ module LedgerTillerExport
41
41
  def account_for_row(row); end
42
42
  end
43
43
 
44
- class RegexpRule < T::Struct
44
+ class RegexpRule
45
45
  extend T::Sig
46
+
47
+ include T::Props
48
+ include T::Props::Constructor
49
+
46
50
  include RuleInterface
47
51
 
48
52
  const :match, Regexp
@@ -61,26 +65,17 @@ module LedgerTillerExport
61
65
  class Exporter
62
66
  extend T::Sig
63
67
 
64
- sig {returns(T::Array[RuleInterface])}
65
- attr_reader :rules
66
-
67
- sig {returns(String)}
68
- attr_reader :spreadsheet
69
-
70
- sig {returns(String)}
71
- attr_reader :worksheet
68
+ include T::Props
69
+ include T::Props::Constructor
72
70
 
73
- sig {returns(String)}
74
- attr_reader :default_account
71
+ const :rules, T::Array[RuleInterface]
72
+ const :spreadsheet, String
73
+ const :worksheet, String
74
+ const :default_account, String
75
+ const :ledger_pretty_print_options, String
75
76
 
76
- sig {returns(String)}
77
- attr_reader :ledger_pretty_print_options
78
-
79
- sig {returns(GoogleDrive::Session)}
80
- attr_reader :session
81
-
82
- sig {returns(LedgerGen::Journal)}
83
- attr_reader :journal
77
+ const :session, GoogleDrive::Session, factory: ->{GoogleDrive::Session.from_config('.config.json')}
78
+ const :journal, LedgerGen::Journal, factory: ->{LedgerGen::Journal.new}
84
79
 
85
80
  sig do
86
81
  params(
@@ -93,16 +88,15 @@ module LedgerTillerExport
93
88
  ).void
94
89
  end
95
90
  def initialize(rules:, spreadsheet:, worksheet: 'Transactions', default_account: 'Expenses:Misc', ledger_pretty_print_options: '--sort=date', ledger_date_format: '%m/%d')
96
- @rules = T.let(rules, T::Array[RuleInterface])
97
- @spreadsheet = T.let(spreadsheet, String)
98
- @worksheet = T.let(worksheet, String)
99
- @default_account = T.let(default_account, String)
100
- @ledger_pretty_print_options = T.let(ledger_pretty_print_options, String)
101
-
102
- @session = T.let(GoogleDrive::Session.from_config('.config.json'), GoogleDrive::Session)
103
- @journal = T.let(LedgerGen::Journal.new, LedgerGen::Journal)
91
+ super(
92
+ rules: rules,
93
+ spreadsheet: spreadsheet,
94
+ worksheet: worksheet,
95
+ default_account: default_account,
96
+ ledger_pretty_print_options: ledger_pretty_print_options,
97
+ )
104
98
 
105
- @journal.date_format = ledger_date_format
99
+ self.journal.date_format = ledger_date_format
106
100
  end
107
101
 
108
102
  sig {void}
@@ -125,7 +119,7 @@ module LedgerTillerExport
125
119
  journal_transaction(row)
126
120
  end
127
121
 
128
- puts @journal.pretty_print(@ledger_pretty_print_options)
122
+ puts journal.pretty_print(ledger_pretty_print_options)
129
123
  end
130
124
 
131
125
  sig {params(row: Row).returns(T::Boolean)}
@@ -1,4 +1,4 @@
1
1
  # typed: strict
2
2
  module LedgerTillerExport
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ledger_tiller_export
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pete Keen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-20 00:00:00.000000000 Z
11
+ date: 2020-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sorbet-runtime