[macruby-changes] [4316] MacRuby/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Jul 2 06:13:26 PDT 2010


Revision: 4316
          http://trac.macosforge.org/projects/ruby/changeset/4316
Author:   eloy.de.enige at gmail.com
Date:     2010-07-02 06:13:23 -0700 (Fri, 02 Jul 2010)
Log Message:
-----------
Merge DietRB 0.4.7, for ticket #747

Modified Paths:
--------------
    MacRuby/trunk/bin/irb
    MacRuby/trunk/lib/irb/formatter.rb
    MacRuby/trunk/lib/irb/version.rb

Modified: MacRuby/trunk/bin/irb
===================================================================
--- MacRuby/trunk/bin/irb	2010-07-01 18:37:59 UTC (rev 4315)
+++ MacRuby/trunk/bin/irb	2010-07-02 13:13:23 UTC (rev 4316)
@@ -14,6 +14,7 @@
     opt.on("-r load-lib",     "Loads the given library (same as `ruby -r')") { |lib| require lib }
     opt.on("-d",              "Set $DEBUG to true (same as `ruby -d')") { $DEBUG = true }
     opt.on("-I path",         "Add path to $LOAD_PATH") { |path| $LOAD_PATH.unshift(path) }
+    opt.on("--noinspect",     "Don't use inspect for output") { IRB.formatter.inspect = false }
     opt.on("--simple-prompt", "Simple prompt mode") { IRB.formatter.prompt = :simple }
     opt.on("--noprompt",      "No prompt mode") { IRB.formatter.prompt = nil }
     opt.on("-v", "--version", "Print the version of #{bin}") do

Modified: MacRuby/trunk/lib/irb/formatter.rb
===================================================================
--- MacRuby/trunk/lib/irb/formatter.rb	2010-07-01 18:37:59 UTC (rev 4315)
+++ MacRuby/trunk/lib/irb/formatter.rb	2010-07-02 13:13:23 UTC (rev 4316)
@@ -17,11 +17,13 @@
     SYNTAX_ERROR   = "SyntaxError: compile error\n(irb):%d: %s"
     SOURCE_ROOT    = /^#{File.expand_path('../../../', __FILE__)}/
     
-    attr_writer :prompt
-    attr_reader :filter_from_backtrace
+    attr_writer   :prompt
+    attr_accessor :inspect
+    attr_reader   :filter_from_backtrace
     
     def initialize
-      @prompt = :default
+      @prompt  = :default
+      @inspect = true
       @filter_from_backtrace = [SOURCE_ROOT]
     end
     
@@ -35,7 +37,13 @@
     end
     
     def inspect_object(object)
-      object.respond_to?(:pretty_inspect) ? object.pretty_inspect : object.inspect
+      if @inspect
+        object.respond_to?(:pretty_inspect) ? object.pretty_inspect : object.inspect
+      else
+        address = object.__id__ * 2
+        address += 0x100000000 if address < 0
+        "#<#{object.class}:0x%x>" % address
+      end
     end
     
     def result(object)

Modified: MacRuby/trunk/lib/irb/version.rb
===================================================================
--- MacRuby/trunk/lib/irb/version.rb	2010-07-01 18:37:59 UTC (rev 4315)
+++ MacRuby/trunk/lib/irb/version.rb	2010-07-02 13:13:23 UTC (rev 4316)
@@ -6,11 +6,16 @@
 
 module IRB
   module VERSION #:nodoc:
+    NAME  = 'DietRB'
     MAJOR = 0
     MINOR = 4
-    TINY  = 5
+    TINY  = 7
     
     STRING = [MAJOR, MINOR, TINY].join('.')
-    DESCRIPTION = "#{STRING} (DietRB)"
+    DESCRIPTION = "#{NAME} (#{STRING})"
   end
-end
\ No newline at end of file
+  
+  def self.version
+    IRB::VERSION::DESCRIPTION
+  end
+end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100702/4c3b6040/attachment-0001.html>


More information about the macruby-changes mailing list