[macruby-changes] [4387] MacRubyWebsite/trunk/content/documentation/rubycocoa-to-macruby.txt

source_changes at macosforge.org source_changes at macosforge.org
Wed Jul 28 12:46:49 PDT 2010


Revision: 4387
          http://trac.macosforge.org/projects/ruby/changeset/4387
Author:   lsansonetti at apple.com
Date:     2010-07-28 12:46:49 -0700 (Wed, 28 Jul 2010)
Log Message:
-----------
forgot to commit these small details

Modified Paths:
--------------
    MacRubyWebsite/trunk/content/documentation/rubycocoa-to-macruby.txt

Modified: MacRubyWebsite/trunk/content/documentation/rubycocoa-to-macruby.txt
===================================================================
--- MacRubyWebsite/trunk/content/documentation/rubycocoa-to-macruby.txt	2010-07-28 19:40:27 UTC (rev 4386)
+++ MacRubyWebsite/trunk/content/documentation/rubycocoa-to-macruby.txt	2010-07-28 19:46:49 UTC (rev 4387)
@@ -114,8 +114,8 @@
 <pre class="commands">
 # MacRuby code
 def saveWorld(planet, fromVillain: badguy, withHero:superhero)
-	superhero.fight(badguy)
-	planet.thank(superhero)
+  superhero.fight(badguy)
+  planet.thank(superhero)
 end
 </pre>
 
@@ -194,14 +194,14 @@
 
 h3. Exception Handling
 
-Though Ruby's @Exception@ class and Objective-C's @NSException@ class are not technically bridged classes, @begin...rescue@ blocks in MacRuby can catch both Ruby @Exceptions@ and Cocoa @NSExceptions at . Conversely, you can catch MacRuby @Exceptions@ with Objective-C's @try@@/@catch at .
+Though Ruby's @Exception@ class and Objective-C's @NSException@ class are not technically bridged classes, @begin...rescue@ blocks in MacRuby can catch both Ruby @Exceptions@ and Cocoa @NSExceptions at . Conversely, you can catch MacRuby @Exceptions@ with Objective-C's @@try@/@@catch at .
 
 h3. Other Syntactic Extensions
 
 The MacRuby team has ported the syntactic extensions present in RubyCocoa for cases when Objective-C idioms differ with Ruby idioms, such as in the case of mutator methods and boolean accessor methods:
 
 <pre class="commands">
-layer.setPosition = [100, 100]	# Objective-C style
+layer.setPosition([100, 100])	# Objective-C style
 layer.position = [100, 100]	# Ruby style; calls the same method the Objective-C one does
 layer.isHidden			# Objective-C style
 layer.hidden?			# Ruby allows the '?' character in method names
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100728/07f90393/attachment.html>


More information about the macruby-changes mailing list