Hi all, I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing: {{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}} what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433
Here is an example of how to use NSOpenPanel: https://github.com/mattetti/pastis/blob/master/app/Pastis/filter_window_cont... def browse(sender) dialog = NSOpenPanel.openPanel # Disable the selection of files in the dialog. dialog.canChooseFiles = false # Enable the selection of directories in the dialog. dialog.canChooseDirectories = true # Disable the selection of multiple items in the dialog. dialog.allowsMultipleSelection = false # Display the dialog and process the selected folder if dialog.runModalForDirectory(nil, file:nil) == NSOKButton selection = dialog.filenames.first location.stringValue = dialog.filenames.first.to_s end end - Matt On Sun, Jan 9, 2011 at 8:09 AM, Rolando Abarca <rolando@gamesforfood.com>wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
I realize I didn't really reply to your question, the following code should work: {{{ def loadSprite(sender) handler = lambda do |code| return if code == NSCancelButton # do things with the panel's date otherwise end @panel.beginSheetModalForWindow(@window, completionHandler: handler) end }}} - Matt On Sun, Jan 9, 2011 at 8:09 AM, Rolando Abarca <rolando@gamesforfood.com>wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
So It seems to me the only change there is uninlining the lambda and assigning it to a throwaway variable. That feels like busywork. I suspect this has to do with keeping a reference so it doesn't get GC'd. Just a hunch. Am I getting there? Why is this needed? On 2011-01-09, at 17:10 , Matt Aimonetti wrote:
I realize I didn't really reply to your question, the following code should work:
{{{ def loadSprite(sender) handler = lambda do |code| return if code == NSCancelButton # do things with the panel's date otherwise end
@panel.beginSheetModalForWindow(@window, completionHandler: handler) end }}}
- Matt
On Sun, Jan 9, 2011 at 8:09 AM, Rolando Abarca <rolando@gamesforfood.com>wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
I suspect this has to do with keeping a reference so it doesn't get GC'd. Just a hunch. Am I getting there?
That's my guess too, if you pass the lambda as a param, it might get GC'd and when the panel is done, it won't have a reference to the handler. - Matt On Sun, Jan 9, 2011 at 11:46 AM, Caio Chassot <lists@caiochassot.com> wrote:
So It seems to me the only change there is uninlining the lambda and assigning it to a throwaway variable. That feels like busywork.
I suspect this has to do with keeping a reference so it doesn't get GC'd. Just a hunch. Am I getting there?
Why is this needed?
On 2011-01-09, at 17:10 , Matt Aimonetti wrote:
I realize I didn't really reply to your question, the following code
should
work:
{{{ def loadSprite(sender) handler = lambda do |code| return if code == NSCancelButton # do things with the panel's date otherwise end
@panel.beginSheetModalForWindow(@window, completionHandler: handler) end }}}
- Matt
On Sun, Jan 9, 2011 at 8:09 AM, Rolando Abarca <rolando@gamesforfood.com wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
This hack isn't needed anymore as of 0.8. Passing the Proc inline should just be fine. Laurent On Jan 9, 2011, at 12:22 PM, Matt Aimonetti wrote:
I suspect this has to do with keeping a reference so it doesn't get GC'd. Just a hunch. Am I getting there?
That's my guess too, if you pass the lambda as a param, it might get GC'd and when the panel is done, it won't have a reference to the handler.
- Matt
On Sun, Jan 9, 2011 at 11:46 AM, Caio Chassot <lists@caiochassot.com> wrote: So It seems to me the only change there is uninlining the lambda and assigning it to a throwaway variable. That feels like busywork.
I suspect this has to do with keeping a reference so it doesn't get GC'd. Just a hunch. Am I getting there?
Why is this needed?
On 2011-01-09, at 17:10 , Matt Aimonetti wrote:
I realize I didn't really reply to your question, the following code should work:
{{{ def loadSprite(sender) handler = lambda do |code| return if code == NSCancelButton # do things with the panel's date otherwise end
@panel.beginSheetModalForWindow(@window, completionHandler: handler) end }}}
- Matt
On Sun, Jan 9, 2011 at 8:09 AM, Rolando Abarca <rolando@gamesforfood.com>wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hi Rolando, The syntax is simple, you simply pass a Proc project. Here is an example: framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 }) It looks like the snippet you pasted should just work. Did you find a problem? Laurent On Jan 9, 2011, at 8:09 AM, Rolando Abarca wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Laurent you are right, however I noticed a little gotcha: If you use the following code: panel.beginSheetModalForWindow window, completionHandler: Proc.new do |result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") end You get an argument error: tried to create Proc object without a block (ArgumentError) However using the curly brackets would work: panel.beginSheetModalForWindow window, completionHandler: Proc.new{|result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") } Finally, the only way to get the do/end proc approach to work is to use the parenthesis around the arguments: panel.beginSheetModalForWindow(window, completionHandler: Proc.new do |result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") end) - Matt On Sun, Jan 9, 2011 at 2:22 PM, Laurent Sansonetti <lsansonetti@apple.com>wrote:
Hi Rolando,
The syntax is simple, you simply pass a Proc project.
Here is an example:
framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 })
It looks like the snippet you pasted should just work. Did you find a problem?
Laurent
On Jan 9, 2011, at 8:09 AM, Rolando Abarca wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
This seems to be a Ruby syntax point, unrelated to MacRuby. Laurent On Jan 9, 2011, at 2:32 PM, Matt Aimonetti wrote:
Laurent you are right, however I noticed a little gotcha:
If you use the following code:
panel.beginSheetModalForWindow window, completionHandler: Proc.new do |result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") end
You get an argument error: tried to create Proc object without a block (ArgumentError)
However using the curly brackets would work:
panel.beginSheetModalForWindow window, completionHandler: Proc.new{|result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") }
Finally, the only way to get the do/end proc approach to work is to use the parenthesis around the arguments:
panel.beginSheetModalForWindow(window, completionHandler: Proc.new do |result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") end)
- Matt
On Sun, Jan 9, 2011 at 2:22 PM, Laurent Sansonetti <lsansonetti@apple.com> wrote: Hi Rolando,
The syntax is simple, you simply pass a Proc project.
Here is an example:
framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 })
It looks like the snippet you pasted should just work. Did you find a problem?
Laurent
On Jan 9, 2011, at 8:09 AM, Rolando Abarca wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
You are right, still a gotcha tho: Ruby 1.9.2: def foo(a, b={}) b[:handler].call if b.has_key?(:handler) end foo :bar, handler: Proc.new do puts 42 end `new': tried to create Proc object without a block (ArgumentError) def foo(a, b={}) b[:handler].call if b.has_key?(:handler) end foo :bar, handler: Proc.new{ puts 42 } Works fine. I guess this is due to the fact that we are using CRuby's parser. I got a bit confused because MacRuby allows you to define methods like that: def foo(a, b:handler) handler.call end foo :bar, b: Proc.new{ puts 42 } Which is an extension of the Ruby syntax. Anyways, thanks for the heads up, I didn't notice it got fixed in 0.8 - Matt On Sun, Jan 9, 2011 at 2:44 PM, Laurent Sansonetti <lsansonetti@apple.com>wrote:
This seems to be a Ruby syntax point, unrelated to MacRuby.
Laurent
On Jan 9, 2011, at 2:32 PM, Matt Aimonetti wrote:
Laurent you are right, however I noticed a little gotcha:
If you use the following code:
panel.beginSheetModalForWindow window, completionHandler: Proc.new do |result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") end
You get an argument error: tried to create Proc object without a block (ArgumentError)
However using the curly brackets would work:
panel.beginSheetModalForWindow window, completionHandler: Proc.new{|result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") }
Finally, the only way to get the do/end proc approach to work is to use the parenthesis around the arguments:
panel.beginSheetModalForWindow(window, completionHandler: Proc.new do |result| return if (result == NSCancelButton) path = panel.filename dest_path = applicationSupportFolder guid = NSProcessInfo.processInfo.globallyUniqueString dest_path = "#{dest_path}/#{guid}" error = Pointer.new(:id) NSFileManager.defaultManager.copyItemAtPath(path, toPath:dest_path, error:error) NSApp.presentError(error) if error[0] movie.setValue(dest_path, forKey:"imagePath") end)
- Matt
On Sun, Jan 9, 2011 at 2:22 PM, Laurent Sansonetti <lsansonetti@apple.com>wrote:
Hi Rolando,
The syntax is simple, you simply pass a Proc project.
Here is an example:
framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 })
It looks like the snippet you pasted should just work. Did you find a problem?
Laurent
On Jan 9, 2011, at 8:09 AM, Rolando Abarca wrote:
Hi all,
I've taken a look at the referred issue (#712), but I'm not sure of the final implemented syntax. I'm trying to use a NSOpenPanel, so far this is what I'm doing:
{{{ def loadSprite(sender) @panel.beginSheetModalForWindow(@window, completionHandler:lambda { |code| NSLog("code: #{code}") }) end }}}
what's the Right Way(tm) to use a NSOpenPanel? thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433 _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
You are right, still a gotcha tho:
Ruby 1.9.2:
def foo(a, b={}) b[:handler].call if b.has_key?(:handler) end foo :bar, handler: Proc.new do puts 42 end
`new': tried to create Proc object without a block (ArgumentError)
Works if you add parentheses though : def foo(a, b={}) b[:handler].call if b.has_key?(:handler) end foo :bar, handler: (Proc.new do puts 42 end)
Yep, Chad Fowler explained to me that it's the difference between precedence and binding with do/end vs {} - Matt On Sun, Jan 9, 2011 at 5:57 PM, Vincent Isambart <vincent.isambart@gmail.com
wrote:
You are right, still a gotcha tho:
Ruby 1.9.2:
def foo(a, b={}) b[:handler].call if b.has_key?(:handler) end foo :bar, handler: Proc.new do puts 42 end
`new': tried to create Proc object without a block (ArgumentError)
Works if you add parentheses though : def foo(a, b={}) b[:handler].call if b.has_key?(:handler) end foo :bar, handler: (Proc.new do puts 42 end) _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Hi Laurent, yes... I keep getting an "EXC_BAD_ACCESS" error, the backtrace would be: #0 0x20052bbc0 in ?? #1 0x7fff823e0bd1 in -[NSApplication endSheet:returnCode:] #2 0x1000f2dad in rb_objc_isEqual #3 0x7fff822f2e9a in -[NSApplication sendAction:to:from:] #4 0x7fff822f2df9 in -[NSControl sendAction:to:] #5 0x7fff8237e76b in -[NSCell trackMouse:inRect:ofView:untilMouseUp:] #6 0x7fff823af2aa in -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] #7 0x7fff8237d215 in -[NSControl mouseDown:] here's my ruby code (the action executed by a button): {{{ def loadFile(sender) panel = NSOpenPanel.openPanel panel.beginSheetModalForWindow(@window, completionHandler:Proc.new { |result| NSLog("here: #{result}") }) end }}} testing using macirb, I get the same seg fault: {{{ $ macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| irb(main):004:1> p obj irb(main):005:1> stop.assign(true) if index == 2 irb(main):006:1> }) Segmentation fault $ }}} I'm using MacRuby 0.8 Thanks for any tip! On Sun, Jan 9, 2011 at 7:22 PM, Laurent Sansonetti <lsansonetti@apple.com> wrote:
Hi Rolando,
The syntax is simple, you simply pass a Proc project.
Here is an example: framework 'Foundation' a = [1, 2, 3, 4, 5] a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| p obj stop.assign(true) if index == 2 }) It looks like the snippet you pasted should just work. Did you find a problem? Laurent
-- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433
On Jan 11, 2011, at 5:40 PM, Rolando Abarca wrote:
I'm using MacRuby 0.8
Works for me! macruby -version MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64] macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| irb(main):004:1> p obj irb(main):005:1> stop.assign(true) if index == 2 irb(main):006:1> }) 1 2 3 => [1, 2, 3, 4, 5] --- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
Can you make sure you are using the latest BridgeSupport? - Matt Sent from my iPhone On Jan 11, 2011, at 10:01, Joel Reymont <joelr1@gmail.com> wrote:
On Jan 11, 2011, at 5:40 PM, Rolando Abarca wrote:
I'm using MacRuby 0.8
Works for me!
macruby -version MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| irb(main):004:1> p obj irb(main):005:1> stop.assign(true) if index == 2 irb(main):006:1> }) 1 2 3 => [1, 2, 3, 4, 5]
--- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Matt, I -am- using the latest BridgeSupport (Preview 2) if you are talking to me. On Jan 11, 2011, at 6:06 PM, Matt Aimonetti wrote:
Can you make sure you are using the latest BridgeSupport?
- Matt
Sent from my iPhone
On Jan 11, 2011, at 10:01, Joel Reymont <joelr1@gmail.com> wrote:
On Jan 11, 2011, at 5:40 PM, Rolando Abarca wrote:
I'm using MacRuby 0.8
Works for me!
macruby -version MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new { |obj, index, stop| irb(main):004:1> p obj irb(main):005:1> stop.assign(true) if index == 2 irb(main):006:1> }) 1 2 3 => [1, 2, 3, 4, 5]
--- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
Joel, sorry I meant to say that to Rolando, I believe it might be the reason why it doesn't work for him. - Matt On Tue, Jan 11, 2011 at 10:08 AM, Joel Reymont <joelr1@gmail.com> wrote:
Matt,
I -am- using the latest BridgeSupport (Preview 2) if you are talking to me.
On Jan 11, 2011, at 6:06 PM, Matt Aimonetti wrote:
Can you make sure you are using the latest BridgeSupport?
- Matt
Sent from my iPhone
On Jan 11, 2011, at 10:01, Joel Reymont <joelr1@gmail.com> wrote:
On Jan 11, 2011, at 5:40 PM, Rolando Abarca wrote:
I'm using MacRuby 0.8
Works for me!
macruby -version MacRuby 0.9 (ruby 1.9.2) [universal-darwin10.0, x86_64]
macirb irb(main):001:0> framework 'Foundation' => true irb(main):002:0> a = [1,2,3,4,5] => [1, 2, 3, 4, 5] irb(main):003:0> a.enumerateObjectsUsingBlock(Proc.new { |obj, index,
stop|
irb(main):004:1> p obj irb(main):005:1> stop.assign(true) if index == 2 irb(main):006:1> }) 1 2 3 => [1, 2, 3, 4, 5]
--- http://wagerlabs.com | @wagerlabs | http://www.linkedin.com/in/joelreymont
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
You're right: using BridgeSupport Preview 2 works! :-) Thanks! -- Rolando Abarca M. Games For Food S.p.A. http://www.gamesforfood.com Phone: +1 (408) 345-5433
participants (6)
-
Caio Chassot
-
Joel Reymont
-
Laurent Sansonetti
-
Matt Aimonetti
-
Rolando Abarca
-
Vincent Isambart