怎样的Rails和JRuby关系? [英] How do Rails and Jruby relate?

查看:163
本文介绍了怎样的Rails和JRuby关系?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:我有一个由许多开发人员访问的Java库 - 通常是通过Java。然而,一些开发者希望通过一个Ruby API访问此。我引力JRuby中的方向,以实现一个Java的Ruby的API。

Background: I have a java library that is accessed by many developers - usually via java. However, a few devs hope to access this via a Ruby API. I am gravitating in the direction of Jruby in order to implement a Java-Ruby API.

问题:


  1. 我主要担心的是,这些开发商将不能利用该API在当前,Ruby on Rails的开发框架;而是必须JRuby的Rails环境中运行。难道这会是这样?

  1. My main concern is that these developers will not be able to utilize the API in their current, Ruby on Rails development framework; but instead will have to operate within Jruby's rails environment. Is this going to be the case?

也许我缺少on Rails的JRuby和红宝石之间的连接。但似乎,你可以在Rails的不是工作,或在JRuby的轨工作 - 这些技术上的两种不同的开发环境?

Perhaps I'm missing a connection between Jruby and Ruby on Rails. But it seems that you can either work in Rails, or work in Jruby's rails - are these technically two different development environments?

我真的AP preciate任何光线有人能阐明这..

I would really appreciate any light someone could shed on this..

修改:迫使开发商(实际上客户更具体)进行大量修改自己的项目,以适应这个API是不是一个真正的选择。所以,如果他们的Rails应用将不得不被转换成的JRuby on Rails的应用程序,那么也许有人可以提供但对我来说(比其他的JRuby),另一种选择?

Edit: Forcing developers (actually clients to be more specific) to make large changes to their projects in order to accomodate for this API is not really an option. So, if their Rails apps would have to be converted to Jruby on Rails apps, then perhaps someone could offer yet another alternative for me (other than Jruby)?

推荐答案

首先,我要指出的Ruby on Rails是一个简单的Ruby code,和相同的code可以在JRuby的环境中运行(在JVM)或MRI(用C语言编写)运行。

First, I should mention that Ruby on Rails is simply Ruby code, and the same code can run in the JRuby environment (on the JVM) or the MRI (written in C) runtime.

然而,只有JRuby中可以加载Java类和使用的Java API。要求你的客户切换其部署环境,JRuby的可能是不可行的,但如果你可以设置在Java服务,讲XML或JSON那么他们将能够轻松地使用它从Rails的。

However, only JRuby can load Java classes and use a Java API. Asking your clients to switch their deployment environment to JRuby may not be feasible, but if you can set up a service in Java that speaks XML or JSON then they will be able to easily use it from Rails.

这篇关于怎样的Rails和JRuby关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆