Questions tagged [macruby]

MacRuby is an implementation of the Ruby 1.9 programming language in ObjC for Mac OSX

MacRuby is an implementation of Ruby 1.9 directly on top of Mac OS X core technologies such as the Objective-C runtime and garbage collector, the LLVM compiler infrastructure and the Foundation and ICU frameworks. It is the goal of MacRuby to enable the creation of full-fledged Mac OS X applications which do not sacrifice performance in order to enjoy the benefits of using Ruby.

http://macruby.org/

221 questions
3
votes
1 answer

MacRuby + Interface Builder: How to display, then close, then display a window again

I'm a complete n00b with MacRuby and Cocoa, so keep that in mind when answering - I need lots of details and explanation. :) I've set up a simple project that has 2 windows in it, both of which are built with Interface Builder. The first window is a…
Derick Bailey
  • 72,004
  • 22
  • 206
  • 219
3
votes
1 answer

How to create an image from canvas data?

In my application I am trying to save an arbitrary part of a rendered HTML canvas to an image file. In my Javascript I call ctx.getImageData(x, y, w, h) and pass the resulting object to my macruby code (though if you know a solution in objc I am…
Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106
3
votes
1 answer

How do you call C functions from MacRuby?

I'd like to try to use MacRuby with CoreAudio on OS X, but most of these APIs are C functions. Do I have to use Ruby DL, or does MacRuby offer another way?
dan
  • 43,914
  • 47
  • 153
  • 254
3
votes
2 answers

Using MacRuby to Test iPhone Application?

I have an existing iPhone app, written in Objective-C, that I'd like to add some automated tests to. I've read this article about testing with MacRuby, which sounds great but it's aimed at testing desktop frameworks. How can I add MacRuby tests to…
Justin Voss
  • 6,294
  • 6
  • 35
  • 39
3
votes
2 answers

Error when using --static option with macrubyc

I want to create a binary executable for a relatively simple script that would not require people to install macruby or HotCocoa. The script is here. I've understood that I want to use the --static option for the compiler and I'm using the following…
Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106
3
votes
4 answers

How to install Nokogiri as a Macruby gem?

The latest MacRuby release notes (v0.6) state that the authors have managed to get this release working with the SQLite and Nokogiri gems. However when I run sudo macgem install nokogiri I get the following errors: ERROR: Error installing…
Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106
3
votes
2 answers

MacRuby: objective-c runtime is same as ruby runtime

I have no formal education in computer science but I have been programming in Java, Ruby, jQuery for a long time. I was checking out macruby project. I keep running into statements which are similar to "In MacRuby objective-c runtime is same as ruby…
Roger
  • 3,919
  • 7
  • 30
  • 37
3
votes
2 answers

Calling a different superclass init method from custom initializer in MacRuby

In Objective C, a custom init method must call the superclass's designated initializer. Consider the following custom init method for a sublcass of NSView: - (void)initWithFrame:(CGRect)aFrame andName:(NSString *)aName { if(self = [super…
maxedison
  • 17,243
  • 14
  • 67
  • 114
3
votes
1 answer

How do I create a C Pointer in MacRuby?

I am working with a C Framework in MacRuby which has a structure int CPhidget_getSerialNumber(CPhidgetHandle phid,int * serialNumber) You can see the full documentation here (if you are interested). In MacRuby I have tried the following: i =…
tsugua
  • 197
  • 1
  • 13
2
votes
1 answer

MacRuby: How to read a plist file?

I bet this is super simple and easy but can't find a basic example online. How can I read data from a plist file in my project using MacRuby? Solution: Turns out there's a few different ways to do it, but the cleanest I've found (so far) is to use…
Andrew
  • 227,796
  • 193
  • 515
  • 708
2
votes
3 answers

Why doesn't keyDown get called if I don't use XCode and IB?

When I subclass a widget and define a keyDown method, and then in InterfaceBuilder assign the class of a widget to be the class I defined with the keyDown method, it seems to work fine. However, if I do it complete programmatically as illustrated in…
aryeh
  • 2,195
  • 1
  • 16
  • 23
2
votes
1 answer

What's the rule to convert CocoaAPI to MacRuby API

- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows: (BOOL)flag { [self showWindow:self]; return YES; } how to convert this method to MacRuby ? I tried def applicationShouldHandleReopen(the_application, k) …
fake name
  • 47
  • 7
2
votes
1 answer

Passing a CFStringRef pointer to a C function in MacRuby

I wanted to call the following function from OS X's DVDPlayback framework: OSStatus DVDGetMediaVolumeCFName ( CFStringRef *outDiscVolumeCFName ); Eventually, I came up with the following working code: framework 'DVDPlayback' p2 =…
Sean DeNigris
  • 6,306
  • 1
  • 31
  • 37
2
votes
1 answer

NSView with NSImage inside of it -- how come NSImage doesn't move with the view which is its parent?

I am writing a simple MacRuby app. I have an NSView that draws an image inside of itself when its drawRect() is called. Inside that NSView subclass my drawRect() has (among some other lines of code) image =…
briangonzalez
  • 1,606
  • 16
  • 21
2
votes
1 answer

Can gems be assigned different interpreters?

I fee like I've seen that this was possible in some documentation before, but now I'm not able to find it. Is it possible to have a gemfile like: gem "somegem", :interpreter => :MRI gem "othergem", :interpreter => :macruby etc, etc I am needing…
Jeremy Smith
  • 14,727
  • 19
  • 67
  • 114