« Burn and distribute | Main | Clarification about last post »

Ruby and Cocoa

I woke up around 6:00 am (very early for Portuguese standards) and couldn't get back to sleep.

I had been reading about Ruby on Rails and I was thinking about it, how it could affect some of my projects.

Yet, for some reason, I started thinking about Cocoa. I knew that there was a Ruby/Cocoa framework, and I have some experience with CamelBones, the Perl/Cocoa framework. How easy is to create a small Cocoa app in Ruby?

Well, check it out: a Web browser made in Ruby and Cocoa. It works for me, but I don't know if all the frameworks where included.

It was my first Ruby program. Ever. An it was not a very big one:

require 'osx/cocoa'
require 'osx/webkit'

class AppController < OSX::NSObject
  include OSX

  ib_outlets :inputText, :previewWindow;

  def previewBtnClicked (sender)
    urlText = @inputText.stringValue
    url = NSURL.URLWithString(urlText);
    request = NSURLRequest.requestWithURL(url)
    @previewWindow.mainFrame.loadRequest(request)
  end
end

Anyway, I'll do a short movie next week: How to build a web browser with Ruby in 20 minutes.

Contacts

melo@simplicidade.org (XMPP/email)
+351 302 029 050 (voice)
melopt (Skype)

IronMan challenge

Iron Man badge Are you ready to be an Iron Man? Join the challenge and find out! (what is the meaning of this little man?)

Moosaico

Junta-te!

Recent Comments

Powered by Disqus
Creative Commons License
This weblog is licensed under a Creative Commons License.
Powered by
Movable Type 3.2