After installation
Once Moneydance Ruby extension is installed, it adds “Ruby Interface” item to Moneydance Extension menu. Clicking on this item starts Ruby Console that you can use to run Ruby code against live Moneydance framework and data collections.
You can run Ruby scripts via two mechanisms, through Ruby console or from the command line.
Using Ruby console
Ruby Console (IRB, Interactive Ruby) is great for testing your ideas and running one-liners, as well as generally learning your way around Moneydance classes and methods. You can load/execute Ruby source files from console too, using “Load file” button at the bottom. Any output or errors generated by loaded code is fed into the console, and you can continue your IRB session normally once the code is loaded.
Running Ruby scripts from command line
Once you have created (or downloaded) some Ruby scripts, you can run them inside Moneydance environment via special command line mode that this program supports.
You can also run your Ruby scripts via command like this (Unix):
$ moneydance moneydance:fmodule:ruby:file?/path/to/script.rb
On OSX (assuming you installed Moneydance into /Applications), use:
$ /Applications/Moneydance.app/Contents/MacOS/JavaApplicationStub \
-invoke_and_quit moneydance:fmodule:ruby:file?/path/to/script.rb
That’s a mouthful, so you may want to create an alias in your profile.
Working with Moneydance API from Ruby
Moneydance Ruby Primer highlights some of the useful methods and approaches to programmatically accessing Moneydance. Possibilities are limitless, this is Ruby - play with data models interactively, read API reference docs and hack away.
blog comments powered by Disqus