rledger 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7147808ab081244140f4404b9c6a289a9595737a
4
- data.tar.gz: f7f0128c167f34e2f93450877a5cbd9668ee020c
3
+ metadata.gz: 0b43839fa1230be131e41646c59fc077ac7fc8ea
4
+ data.tar.gz: 92d20891d28a525c51924fd093ebdd13f13a9592
5
5
  SHA512:
6
- metadata.gz: bec37a601ef9b3d8a722165d7823632887e9dc6ab74416cddc10bd4beffffd415af00375ed552bf1ec7a485f024daebce076ed7d1679de81fb94c5c6e61877f7
7
- data.tar.gz: 9b055a9d990765af6b66fdbfc01775bcfd6fa751c70683b229df0115b4cc665d21e4444bd599bb0c5240404adc9e8b115c150bb508445d723ed99ed7c189ca15
6
+ metadata.gz: cb3a7639f424d908805a97d33230ceef89a50ee400d429b24e6aa280449b4a4d2e22de8a30aab94b8ece57880cf1a80923064186a9d586ea76ab7663b5e66350
7
+ data.tar.gz: 307478a7898a7682f1ae46269e28720d3543443ef991118f68056aa9d7a57d391853e57a80a63488d8c92b03611a8324079946301ba423d64e13440396b59d75
data/README.md CHANGED
@@ -29,7 +29,7 @@ Or install it yourself as:
29
29
 
30
30
  Try the following commands on a ledger file:
31
31
 
32
- rledger --command statement ledger.txt
32
+ rledger --command statement --voice VOICE ledger.txt
33
33
  rledger --command balance ledger.txt
34
34
 
35
35
  The mileage of the gem will vary, according to the complexity of the
@@ -92,6 +92,10 @@ module Rledger
92
92
  transactions
93
93
  end
94
94
 
95
+ def <=> other
96
+ date <=> other.date
97
+ end
98
+
95
99
  def parse(s)
96
100
  lines = s.split("\n")
97
101
  super(lines[0]) # call super.parse!
@@ -1,3 +1,3 @@
1
1
  module Rledger
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/rledger.rb CHANGED
@@ -26,6 +26,10 @@ module Rledger
26
26
  options[:voice] = voice
27
27
  end
28
28
 
29
+ opts.on("-s", "--sort ASC|DESC", String, "Sort by date") do |sort|
30
+ options[:sort] = sort
31
+ end
32
+
29
33
  #opts.on("-f", "--from_date DATE", Date, "From date") do |from_date|
30
34
  # options[:from_date] = from_date
31
35
  #end
@@ -68,6 +72,13 @@ EOF
68
72
  data += Transaction.read(argv)
69
73
  end
70
74
 
75
+ # sort, if required from the command line
76
+ if options[:sort] == "ASC" then
77
+ data.sort!
78
+ elsif options[:sort] == "DESC" then
79
+ data.sort.reverse!
80
+ end
81
+
71
82
  # now do
72
83
  case options[:command]
73
84
  when "check"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rledger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-22 00:00:00.000000000 Z
11
+ date: 2013-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler