Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mfeckie/ember-cli-opal-rb
Include Opal.rb in your Ember projects
https://github.com/mfeckie/ember-cli-opal-rb
Last synced: 4 months ago
JSON representation
Include Opal.rb in your Ember projects
- Host: GitHub
- URL: https://github.com/mfeckie/ember-cli-opal-rb
- Owner: mfeckie
- License: mit
- Created: 2015-06-05T11:26:32.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2015-06-07T03:32:53.000Z (about 9 years ago)
- Last Synced: 2024-02-16T19:20:32.719Z (5 months ago)
- Language: JavaScript
- Size: 234 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Lists
- awesome-opal - Ember Cli Opalrb - Include Opal.rb in your Ember projects (Uncategorized / Uncategorized)
- awesome-opal - Ember Cli Opalrb - Include Opal.rb in your Ember projects (Uncategorized / Uncategorized)
README
[ ![Codeship Status for mfeckie/ember-cli-opal-rb](https://codeship.com/projects/2a6e98f0-eef3-0132-1b5c-3628cb5d23b0/status?branch=master)](https://codeship.com/projects/84294)
# Ember-cli-opal-rb
[Opal.rb](http://opalrb.org/) is a Ruby to JavaScript compiler.
This addon simply includes Opal as a Service in your Ember application.
## Installation
`ember install ember-cli-opal-rb`
## Usage
There are only really two methods exposed `compileRuby` and `run`
Here's an example of there usage.
```js
import Ember from 'ember';export default Ember.Component.extend({
opal: Ember.inject.service(),
someFunc: function () {
var compiler = this.get('opal')
var textToCompile = this.get('text');//This will give you the Ruby code as JS
var compiled = compiler.compileRuby(textToCompile);
//This will compile and execute the Ruby code
compiler.run(textToCompile);
}
});
```## Dummy app
If you clone the repo and run the server there is an example of a live Ruby to JS converter.
## Running
* `ember server`
* Visit your app at http://localhost:4200.## Running Tests
* `ember try:testall`