https://github.com/xord/cruby
CRuby Interpreter for macOS and iOS
https://github.com/xord/cruby
cocoapods ios macos ruby
Last synced: 12 months ago
JSON representation
CRuby Interpreter for macOS and iOS
- Host: GitHub
- URL: https://github.com/xord/cruby
- Owner: xord
- License: other
- Created: 2014-12-21T11:53:06.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2023-10-11T21:42:27.000Z (over 2 years ago)
- Last Synced: 2024-04-21T03:14:19.060Z (about 2 years ago)
- Topics: cocoapods, ios, macos, ruby
- Language: Ruby
- Homepage:
- Size: 184 KB
- Stars: 16
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CRuby Interpreter for macOS and iOS
This library allows you to embed CRuby interpreter to your macOS or iOS app.

# How To Use
Prepare the following podfile for the Xcode project you want to use CRuby in.
```
platform :ios, '10.0'
pod 'CRuby', git: 'https://github.com/xord/cruby'
```
Run the following in a terminal.
```sh
$ CRUBY_OS=ios pod install --verbose
```
(Due to the long compile time, it is recommended to use the --verbose option)
Where you want to use CRuby, you can evaluate the string as follows.
```objc
CRBValue *result = [CRuby eval:@"[1, 2, 3].map {|n| n ** 2}"];
NSString *string = result.inspect;
NSLog(@"result: %@", string);
```