ledger_gen 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/ledger_gen/journal.rb +4 -1
- data/lib/ledger_gen/transaction.rb +3 -2
- data/lib/ledger_gen/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 763557d263c2408975476acebad9452549128599
|
4
|
+
data.tar.gz: ee0173259c05d1279fdb7f5a5b0d8948edf86c00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac34d6c6d52fc2dc733e85e05d94f826e838207de0e50ece8472a4042de6fe368a820d5eb702e00c7f5281e757286dce1338b5f9453d43f6cc83be88c2ab841f
|
7
|
+
data.tar.gz: 8f975d087063dae424941d8ea23d162267ec3815533cec603a1d4fcc3df32883c6edb1bafb82c438d5b4035fd353a96e49e480979a978f7907fd86f7162ab71e
|
data/README.md
CHANGED
@@ -39,6 +39,16 @@ puts j.pretty_print # ledger binary required
|
|
39
39
|
puts j.to_s # not pretty, but it works without the binary
|
40
40
|
```
|
41
41
|
|
42
|
+
## Limitations
|
43
|
+
|
44
|
+
LedgerGen currently supports a very limited subset of Ledger. In particular, that means:
|
45
|
+
|
46
|
+
* Only supports dollars as commodity
|
47
|
+
* Does not insert thousands separator
|
48
|
+
* Can't insert journal-level comments
|
49
|
+
* No support for building things like periodic entries or automated transactions
|
50
|
+
* No support for virtual transactions
|
51
|
+
|
42
52
|
## Development
|
43
53
|
|
44
54
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/ledger_gen/journal.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module LedgerGen
|
2
2
|
class Journal
|
3
|
+
attr_accessor :date_format
|
4
|
+
|
3
5
|
def self.build
|
4
6
|
journal = new
|
5
7
|
|
@@ -10,10 +12,11 @@ module LedgerGen
|
|
10
12
|
|
11
13
|
def initialize
|
12
14
|
@transactions = []
|
15
|
+
@date_format = '%Y/%m/%d'
|
13
16
|
end
|
14
17
|
|
15
18
|
def transaction
|
16
|
-
txn = Transaction.new
|
19
|
+
txn = Transaction.new(date_format)
|
17
20
|
@transactions << txn
|
18
21
|
|
19
22
|
yield txn
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module LedgerGen
|
2
2
|
class Transaction
|
3
|
-
def initialize
|
3
|
+
def initialize(date_format=nil)
|
4
|
+
@date_format = date_format || '%Y/%m/%d'
|
4
5
|
@postings = []
|
5
6
|
@comments = []
|
6
7
|
end
|
@@ -52,7 +53,7 @@ module LedgerGen
|
|
52
53
|
private
|
53
54
|
|
54
55
|
def date_string
|
55
|
-
@date.strftime(
|
56
|
+
@date.strftime(date_format)
|
56
57
|
end
|
57
58
|
|
58
59
|
def cleared_string
|
data/lib/ledger_gen/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ledger_gen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
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: 2017-
|
11
|
+
date: 2017-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|