GithubHelp home page GithubHelp logo

seekingalpha / bind-it Goto Github PK

View Code? Open in Web Editor NEW

This project forked from louismullie/bind-it

0.0 1.0 0.0 19 KB

BindIt is a tool to facilitate the creation of Java bindings in Ruby.

License: Other

Ruby 100.00%

bind-it's Introduction

About

BindIt is a tool that allows to build platform-agnostic Ruby wrappers for JAVA code. The resulting bindings will work both on the JRuby and MRI platforms. On the MRI platform, BindIt uses the Ruby-Java-Bridge (Rjb) to access Java objects.

BindIt is tested on MRI Ruby 1.9.2 and 1.9.3, as well as JRuby 1.6.7.2 and 1.7.1.

Installing

gem install bind-it

Usage

  1. Create a module into which Java classes will be loaded.
  2. Make sure that module extends BindIt::Binding.
  3. Set your configuration options (see examples below).
  4. Run YourModule.bind to load the default JARs and classes.
  5. Access loaded Java classes using YourModule::YourClass.

Example

require 'bind-it'

module MyBindings 

  extend BindIt::Binding

  # Arguments to use when initializing the JVM.
  self.jvm_args = ['-option1X', '-option2X']

  # If set, JVM output is redirected to file.
  self.log_file = 'log_file.txt'

  # The path in which to look for JAR files.
  self.jar_path = '/path/to/jars/'

  # Default JAR files to load.
  self.default_jars = [
    'jar1.jar',
    'jar2.jar'
  ]

  # Default namespace to use when loading classes.
  self.default_namespace = 'path.to.default'

  # Default classes to load under MyBindings.
  # Shown are the three different ways of adding
  # a class to the default list.
  self.default_classes = [
     # Will search for class in default_namespace.
     ['MyClass'],
     # Supply a non-default namespace.
     ['MyClass', 'path.to.namespace']
  ]

  # Load the default JARs and classes.
  self.bind

end

obj = MyBindings::MyClass.new

Contributing

Feel free to fork the project and send me a pull request!

bind-it's People

Contributors

louismullie avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.