[macruby-changes] [4623] DietRB/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 8 03:50:07 PDT 2010


Revision: 4623
          http://trac.macosforge.org/projects/ruby/changeset/4623
Author:   eloy.de.enige at gmail.com
Date:     2010-10-08 03:50:06 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Change Kernel::IRB() to Kernel::irb() as in the real IRB. Also some more to read.

From: Eloy Duran <eloy.de.enige at gmail.com>

Modified Paths:
--------------
    DietRB/trunk/bin/dietrb
    DietRB/trunk/lib/irb.rb
    DietRB/trunk/spec/irb_spec.rb

Added Paths:
-----------
    DietRB/trunk/README.rdoc

Removed Paths:
-------------
    DietRB/trunk/README

Deleted: DietRB/trunk/README
===================================================================
--- DietRB/trunk/README	2010-10-08 10:49:55 UTC (rev 4622)
+++ DietRB/trunk/README	2010-10-08 10:50:06 UTC (rev 4623)
@@ -1,17 +0,0 @@
-= IRB on a diet, for MacRuby / Ruby 1.9
-
-The goal is to have a small and cleaned up version of IRB. Trimmed down to only
-do the stuff I, and most people I know, actually use.
-
-Trimming down the core code is done mainly by using Ripper, which comes with
-Ruby 1.9, instead of shipping it's own parser etc.
-
-Furthermore, this IRB version specifically targets MacRuby, for now, and allows
-Cocoa development to be done from the command-line. Dietrb will automatically
-override the normal runloop to be ran in a thread and start a NSRunLoop on the
-main thread.
-
-There's still lots to be done, but the ‘basic functionality’ as is now, should
-not grow too much more. For now my things to-do are .irbrc support, completion,
-and investigate what else people really really need. After that it's time to
-polish.
\ No newline at end of file

Added: DietRB/trunk/README.rdoc
===================================================================
--- DietRB/trunk/README.rdoc	                        (rev 0)
+++ DietRB/trunk/README.rdoc	2010-10-08 10:50:06 UTC (rev 4623)
@@ -0,0 +1,60 @@
+= IRB on a diet, for MacRuby / Ruby 1.9
+
+The goal is to have a small and cleaned up version of IRB. Trimmed down to only
+do the stuff I, and most people I know, actually use.
+
+Trimming down the core code is done mainly by using Ripper, which comes with
+Ruby 1.9, instead of shipping it's own parser etc.
+
+Furthermore, this IRB version specifically targets MacRuby, for now, and allows
+Cocoa development to be done from the command-line. Dietrb will automatically
+override the normal runloop to be ran in a thread and start a NSRunLoop on the
+main thread.
+
+There's still lots to be done, but the ‘basic functionality’ as is now, should
+not grow too much more. For now my things to-do are .irbrc support, completion,
+and investigate what else people really really need. After that it's time to
+polish.
+
+= Play
+
+Normal usage:
+
+  irb(main):001:0> class A
+  irb(main):002:1>   def foo
+  irb(main):003:2>     :ok
+  irb(main):004:2>   end
+  irb(main):005:1> end
+  => nil
+  irb(main):006:0> irb A.new
+  irb(#<#<Class:…>::A:…>):001:0> foo
+  => :ok
+  irb(#<#<Class:…>::A:…>):002:0> quit
+  => nil
+  irb(main):007:0> quit
+
+Or on MacRuby, try:
+
+  irb(main):001:0> win = NSWindow.alloc.initWithContentRect([200, 300, 250, 100],
+  irb(main):002:0>                                styleMask: NSTitledWindowMask|NSResizableWindowMask,
+  irb(main):003:0>                                  backing: NSBackingStoreBuffered,
+  irb(main):004:0>                                    defer: false)
+  => #<NSWindow:0x20023eb00>
+  irb(main):005:0> win.orderFrontRegardless
+  => #<NSWindow:0x20023eb00>
+  irb(main):006:0> win.title = 'Hello World'
+  => "Hello World"
+  irb(main):007:0> bye = NSButton.alloc.initWithFrame([10, 10, 80, 80])
+  => #<NSButton:0x20027f820>
+  irb(main):008:0> win.contentView.addSubview(bye)
+  => #<NSView:0x200210320>
+  irb(main):009:0> bye.bezelStyle = NSThickerSquareBezelStyle
+  => 4
+  irb(main):010:0> bye.title = 'Goodbye!'
+  => "Goodbye!"
+  irb(main):011:0> bye.target = NSApp
+  => #<NSApplication:0x200257fe0>
+  irb(main):012:0> bye.action = 'terminate:'
+  => "terminate:"
+  irb(main):013:0> bye.sound = NSSound.soundNamed('Basso')
+  => #<NSSound:0x200248b20>
\ No newline at end of file

Modified: DietRB/trunk/bin/dietrb
===================================================================
--- DietRB/trunk/bin/dietrb	2010-10-08 10:49:55 UTC (rev 4622)
+++ DietRB/trunk/bin/dietrb	2010-10-08 10:50:06 UTC (rev 4623)
@@ -1,4 +1,4 @@
 #!/usr/bin/env ruby
 
 require 'irb'
-IRB(self)
\ No newline at end of file
+irb(self)
\ No newline at end of file

Modified: DietRB/trunk/lib/irb.rb
===================================================================
--- DietRB/trunk/lib/irb.rb	2010-10-08 10:49:55 UTC (rev 4622)
+++ DietRB/trunk/lib/irb.rb	2010-10-08 10:50:06 UTC (rev 4623)
@@ -7,9 +7,9 @@
 
 module Kernel
   # Creates a new IRB::Context with the given +object+ and runs it.
-  def IRB(object)
+  def irb(object)
     IRB::Context.new(object).run
   end
   
-  private :IRB
-end
+  private :irb
+end
\ No newline at end of file

Modified: DietRB/trunk/spec/irb_spec.rb
===================================================================
--- DietRB/trunk/spec/irb_spec.rb	2010-10-08 10:49:55 UTC (rev 4622)
+++ DietRB/trunk/spec/irb_spec.rb	2010-10-08 10:50:06 UTC (rev 4623)
@@ -1,10 +1,10 @@
 require File.expand_path('../spec_helper', __FILE__)
 
-describe "Kernel::IRB()" do
+describe "Kernel::irb" do
   it "creates a new context for the given object and runs it" do
     Readline.stub_input("::IRBRan = self")
     o = Object.new
-    IRB(o)
+    irb(o)
     IRBRan.should == o
   end
 end
\ No newline at end of file
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/0bfed150/attachment.html>


More information about the macruby-changes mailing list