Thanks for the observer recommendations, back when I wrote these examples, we were not yet supporting blocks.
I should probably show both examples now that blocks are properly supported.
- Matt
On 3 Apr 2011, at 18:33, Johannes Fahrenkrug wrote:I don't hate the name MacRuby, but I thought it might be confusing (if someday Ruby becomes the most popular language for writing iOS apps). However, your analogy to the NeXTSTEP frameworks was good.
> I like the name MacRuby :)
> NSObject is also still called NSObject although NeXTStep hasn't been
> around for a long time.
Maybe it just takes a while to appreciate the project name (a bit like how the name "iPad" was unpopular at first).
On 3 Apr 2011, at 19:07, Matt Aimonetti wrote:
> While there is nothing wrong with having this kind of discussion, I don't think we are currently looking into changing the project's name ;)
P.S. In chapter 5 of "MacRuby: The Definitive Guide", you might be able to use -addObserverForName:object:queue:usingBlock: to simplify your NSNotificationCenter examples.
<http://ofps.oreilly.com/titles/9781449380373/ch05.html#_tasks_subprocesses>
<http://ofps.oreilly.com/titles/9781449380373/ch05.html#_notifications>
For the second example, instead of:
> framework 'Foundation'
>
> class NotificationHandler
> def tea_time(notification)
> puts "it's tea time!"
> end
> end
>
> center = NSNotificationCenter.defaultCenter
> notification_handler = NotificationHandler.new
>
> center.addObserver( notification_handler,
> selector: "tea_time:",
> name: 'tea_time_reminder',
> object: nil )
>
> center.postNotificationName("tea_time_reminder", object:self)
You might be able to do:
> framework 'Foundation'
>
> center = NSNotificationCenter.defaultCenter
>
> observer = center.addObserverForName(
> "tea_time_reminder",
> object: nil
> queue: nil
> usingBlock: Proc.new{|notification| puts "it's tea time!" } )
>
> center.postNotificationName("tea_time_reminder", object:self)
_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel