Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/binarymuse/udjrb
Classes and extensions to make working with the UniData Java API via JRuby easier.
https://github.com/binarymuse/udjrb
Last synced: 29 days ago
JSON representation
Classes and extensions to make working with the UniData Java API via JRuby easier.
- Host: GitHub
- URL: https://github.com/binarymuse/udjrb
- Owner: BinaryMuse
- Created: 2011-05-13T22:55:31.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2011-05-13T22:57:28.000Z (over 13 years ago)
- Last Synced: 2024-10-04T02:17:13.163Z (about 1 month ago)
- Language: Ruby
- Homepage:
- Size: 576 KB
- Stars: 2
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
UDJrb is a set of classes and extensions to make it easier to work with the UniData Java API. UDJrb includes a copy of `asjava.jar`, and loads it automatically when you require the library. So, all you need to get start is to install UDJrb via `gem install udjrb` and require it with `require 'udjrb'`.
UDJrb::Session
==============To connect to a UniData database, use the `UDJrb::Session` object.
session = UDJrb::Session.new "username", "password", "host", "account"
This will automatically connect you to the database. Once you're connected, there are a few methods available to you:
* `session.unijava` - returns the underlying `asjava.uniobjects.UniJava` object.
* `session.session` - returns the underlying `UniSession` object.
* `session.disconnect` - disconnect cleanly from the database (uses `UniJava#closeSession()`).Any other method you call will be passed through to the underlying `UniSession` object, which means you can open files, etc. just by calling the method you would normally call on a `UniSession` instance:
person = session.open "PERSON"
person.set_record_id "0123456"
puts "First Name: #{person.read_named_field 'FIRST.NAME'}"
puts "Last Name: #{person.read_named_field 'LAST.NAME'}"UniFile Extensions
==================The following extensions have been added to `UniFile`:
* `file.data(field)` - convienence method for `file.read_named_field(field)`.
UniDynArray Extensions
======================The following extensions have been added to `UniDynArray`:
* `each` - returns each value from the first field in the array (`to_s` is called on each element).
* `include Enumerable` - gives access to the [Enumerable](http://www.ruby-doc.org/core/classes/Enumerable.html) methods by way of `each`.