From c3f3b80bf369fe9a2db5c30f95fb4a9a6a67b29e Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Tue, 13 Aug 2013 22:28:39 -0400 Subject: [PATCH] update example usage in README.md --- README.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/README.md b/README.md index 18bb511..299dd9e 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,25 @@ Or install it yourself as: ## Usage + require "gnucash" + book = Gnucash.open("MyBook.gnucash") + book.accounts.each do |account| + puts "#{account.full_name}: #{account.final_balance}" + end + + act = book.find_account_by_full_name("Assets::Checking") + balance = Gnucash::Value.zero + act.transactions.each do |txn| + balance += txn.value + $stdout.puts(sprintf("%s %8s %8s %s", + txn.date, + txn.value, + balance, + txn.description)) + end + ## Contributing 1. Fork it