[MacRuby-devel] super method

2010-09-07 Thread Robert Rice
Questions on the super method:

Is the super method unique to MacRuby?

super forwards the current message to the superclass with the same method name 
and arguments. Is there a way to send a message to the superclass method with 
different arguments either from within the subclass method of the same name or 
from outside the subclass method of the same name to bypass the subclass method?

Thanks,
Bob Rice

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] super method

2010-09-07 Thread Matt Aimonetti
No it's not unique to MacRuby (Ruby and Obj-C support that feature) and yes you 
can pass other arguments :)

- Matt

Sent from my iPhone

On Sep 7, 2010, at 12:16, Robert Rice  wrote:

> Questions on the super method:
> 
> Is the super method unique to MacRuby?
> 
> super forwards the current message to the superclass with the same method 
> name and arguments. Is there a way to send a message to the superclass method 
> with different arguments either from within the subclass method of the same 
> name or from outside the subclass method of the same name to bypass the 
> subclass method?
> 
> Thanks,
> Bob Rice
> 
> ___
> 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


Re: [MacRuby-devel] super method

2010-09-07 Thread Robert Rice
Thanks Matt:

I didn't see super in the ruby-doc.org/ruby-1.9/index.html unless super is 
short for superclass.

Can I reach a superclass method without having the message go first to my 
subclass override of the method?

Bob Rice


On Sep 7, 2010, at 3:26 PM, Matt Aimonetti wrote:

> No it's not unique to MacRuby (Ruby and Obj-C support that feature) and yes 
> you can pass other arguments :)
> 
> - Matt
> 
> Sent from my iPhone
> 
> On Sep 7, 2010, at 12:16, Robert Rice  wrote:
> 
>> Questions on the super method:
>> 
>> Is the super method unique to MacRuby?
>> 
>> super forwards the current message to the superclass with the same method 
>> name and arguments. Is there a way to send a message to the superclass 
>> method with different arguments either from within the subclass method of 
>> the same name or from outside the subclass method of the same name to bypass 
>> the subclass method?
>> 
>> Thanks,
>> Bob Rice
>> 
>> ___
>> 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


Re: [MacRuby-devel] super method

2010-09-07 Thread Konstantin Haase
On Sep 7, 2010, at 21:53 , Robert Rice wrote:

> I didn't see super in the ruby-doc.org/ruby-1.9/index.html unless super is 
> short for superclass.

In Ruby, super is not a real method call but a key word. Also, it does not 
behave exactly like a method call (implicit arguments/block and what not). 
Therefore it is not in the generated method list.

> 
> Can I reach a superclass method without having the message go first to my 
> subclass override of the method?

Not as easily and general as in Smalltalk but you can do something like this:


class Foo
def foo
20
end
end

class Bar < Foo
def foo
super * 2
end
end

class Baz < Bar
def foo
method = Foo.instance_method(__method__).bind(self)
method.call
end
end

puts Foo.new.foo # => 20
puts Bar.new.foo # => 40
puts Baz.new.foo # => 20

Konstantin

___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] super method

2010-09-07 Thread Matt Aimonetti
Satish has a good blog post on the matter: 
http://rubylearning.com/satishtalim/ruby_overriding_methods.html

You can certainly call super in your subclass before making any modifications 
or calling super based on a condition.

I hope it helps,

- Matt

Sent from my iPhone

On Sep 7, 2010, at 12:53, Robert Rice  wrote:

> Thanks Matt:
> 
> I didn't see super in the ruby-doc.org/ruby-1.9/index.html unless super is 
> short for superclass.
> 
> Can I reach a superclass method without having the message go first to my 
> subclass override of the method?
> 
> Bob Rice
> 
> 
> On Sep 7, 2010, at 3:26 PM, Matt Aimonetti wrote:
> 
>> No it's not unique to MacRuby (Ruby and Obj-C support that feature) and yes 
>> you can pass other arguments :)
>> 
>> - Matt
>> 
>> Sent from my iPhone
>> 
>> On Sep 7, 2010, at 12:16, Robert Rice  wrote:
>> 
>>> Questions on the super method:
>>> 
>>> Is the super method unique to MacRuby?
>>> 
>>> super forwards the current message to the superclass with the same method 
>>> name and arguments. Is there a way to send a message to the superclass 
>>> method with different arguments either from within the subclass method of 
>>> the same name or from outside the subclass method of the same name to 
>>> bypass the subclass method?
>>> 
>>> Thanks,
>>> Bob Rice
>>> 
>>> ___
>>> 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


Re: [MacRuby-devel] Release Build

2010-09-07 Thread Laurent Sansonetti
Hi Henry,

Sorry for the late response.

On Sep 6, 2010, at 5:52 PM, Henry Maddocks wrote:

> I've been working on a MacRuby/Cocoa app and I'm getting to close to release. 
> Is their any docs on how to prepare your app for release? Any tips or tricks?
> 
> I know I will need to embed MacRuby in my app but is there anything else that 
> is required/recommended, eg. can you compile the code?

You just need to add the Embed and Compile targets in your project. These 
targets just call the macruby_deploy command-line tool on your application 
bundle, so you may want to look at the tool by yourself in case your build 
process is different.

These 2 operations will embed MacRuby and compile all your project's source 
code into machine code, removing the .rb files after. It should then be ready 
for release.

Let us know if you have any problem.

Laurent
___
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Cocoa Slides in MacRuby

2010-09-07 Thread Laurent Sansonetti
Hi Matthew,

Looks like a valuable addition to me :) Thanks for proposing to work on this. 
It looks ambitious so if you need help you should probably post it on github so 
that others can translate the original code too.

Laurent

On Aug 27, 2010, at 7:52 PM, Matthew Smith wrote:

> I'm looking at implementing the Cocoa Slides sample application 
> (http://developer.apple.com/mac/library/samplecode/CocoaSlides/Introduction/Intro.html)
>  in MacRuby. Has anyone attempted this yet or interested in contributing?
> 
> Thanks,
> 
> Matthew Smith
> 
> ___
> 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