[macruby-changes] [4729] DietRB/trunk

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 8 04:06:08 PDT 2010


Revision: 4729
          http://trac.macosforge.org/projects/ruby/changeset/4729
Author:   eloy.de.enige at gmail.com
Date:     2010-10-08 04:06:07 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Some more cleaning

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

Modified Paths:
--------------
    DietRB/trunk/bin/dietrb
    DietRB/trunk/lib/irb/completion.rb
    DietRB/trunk/lib/irb/context.rb
    DietRB/trunk/lib/irb.rb

Removed Paths:
-------------
    DietRB/trunk/lib/irb/io/readline.rb
    DietRB/trunk/lib/irb/io.rb

Modified: DietRB/trunk/bin/dietrb
===================================================================
--- DietRB/trunk/bin/dietrb	2010-10-08 11:05:56 UTC (rev 4728)
+++ DietRB/trunk/bin/dietrb	2010-10-08 11:06:07 UTC (rev 4729)
@@ -32,6 +32,7 @@
 IRB.formatter.filter_from_backtrace << /^#{__FILE__}/
 
 if ARGV.empty?
+  require 'irb/driver/readline'
   irb(self, TOPLEVEL_BINDING.dup)
   # TODO make sure!
   puts "ENDED! and this message should show up on stdout"

Modified: DietRB/trunk/lib/irb/completion.rb
===================================================================
--- DietRB/trunk/lib/irb/completion.rb	2010-10-08 11:05:56 UTC (rev 4728)
+++ DietRB/trunk/lib/irb/completion.rb	2010-10-08 11:06:07 UTC (rev 4729)
@@ -1 +1 @@
-IRB.deprecated "The file `irb/completion' has moved to `irb/ext/ecompletion' and is loaded by default.", caller
\ No newline at end of file
+IRB.deprecated "The file `irb/completion' has moved to `irb/ext/completion' and is loaded by default.", caller
\ No newline at end of file

Modified: DietRB/trunk/lib/irb/context.rb
===================================================================
--- DietRB/trunk/lib/irb/context.rb	2010-10-08 11:05:56 UTC (rev 4728)
+++ DietRB/trunk/lib/irb/context.rb	2010-10-08 11:06:07 UTC (rev 4729)
@@ -9,24 +9,13 @@
 module IRB
   class Context
     class << self
-      # attr_accessor :current
-      # 
-      # def make_current(context)
-      #   # Messing with a current context is gonna bite me in the ass when we
-      #   # get to multi-threading, but we'll it when we get there.
-      #   before, @current = @current, context
-      #   yield
-      # ensure
-      #   @current = before
-      # end
-      
       def processors
         @processors ||= []
       end
     end
     
     attr_reader :object, :binding, :line, :source, :processors
-    attr_accessor :io, :formatter, :driver
+    attr_accessor :driver, :formatter
     
     def initialize(object, explicit_binding = nil)
       @object  = object
@@ -45,35 +34,13 @@
     def evaluate(source)
       result = __evaluate__(source.to_s, '(irb)', @line - @source.buffer.size + 1)
       store_result(result)
-      io.puts(formatter.result(result))
+      @driver.puts(formatter.result(result))
       result
     rescue Exception => e
       store_exception(e)
-      io.puts(formatter.exception(e))
+      @driver.puts(formatter.exception(e))
     end
     
-    # Prints the prompt to, and reads input from, the +io+ object and passes
-    # it to all processors.
-    #
-    # The buffer is cleared if an Interrupt exception is raised.
-    # def readline_from_io
-    #   input = io.readline(formatter.prompt(self))
-    #   @processors.each { |processor| input = processor.input(input) }
-    #   input
-    # rescue Interrupt
-    #   clear_buffer
-    #   ""
-    # end
-    
-    # def run
-    #   self.class.make_current(self) do
-    #     while line = readline_from_io
-    #       continue = process_line(line)
-    #       break unless continue
-    #     end
-    #   end
-    # end
-    
     # Returns whether or not the user wants to continue the current runloop.
     # This can only be done at a code block indentation level of 0.
     #
@@ -94,7 +61,7 @@
       return false if @source.terminate?
       
       if @source.syntax_error?
-        io.puts(formatter.syntax_error(@line, @source.syntax_error))
+        @driver.puts(formatter.syntax_error(@line, @source.syntax_error))
         @source.pop
       elsif @source.code_block?
         evaluate(@source)
@@ -110,7 +77,7 @@
     end
     
     def input_line(line)
-      io.puts(formatter.prompt(self) + line)
+      @driver.puts(formatter.prompt(self) + line)
       process_line(line)
     end
     
@@ -118,11 +85,6 @@
       @formatter ||= IRB.formatter
     end
     
-    def io
-      # @io ||= IRB.io
-      @driver
-    end
-    
     def clear_buffer
       @source = Source.new
     end
@@ -135,13 +97,4 @@
       $e = $EXCEPTION = exception
     end
   end
-end
-
-# module Kernel
-#   # Creates a new IRB::Context with the given +object+ and runs it.
-#   def irb(object, binding = nil)
-#     IRB::Context.new(object, binding).run
-#   end
-#   
-#   private :irb
-# end
+end
\ No newline at end of file

Deleted: DietRB/trunk/lib/irb/io/readline.rb
===================================================================
--- DietRB/trunk/lib/irb/io/readline.rb	2010-10-08 11:05:56 UTC (rev 4728)
+++ DietRB/trunk/lib/irb/io/readline.rb	2010-10-08 11:06:07 UTC (rev 4729)
@@ -1,22 +0,0 @@
-require 'readline'
-
-module IRB
-  module IO
-    class Readline
-      attr_reader :input, :output
-      
-      def initialize(input = $stdin, output = $stdout)
-        ::Readline.input  = @input  = input
-        ::Readline.output = @output = output
-      end
-      
-      def readline(prompt)
-        ::Readline.readline(prompt, true)
-      end
-      
-      def puts(*args)
-        @output.puts(*args)
-      end
-    end
-  end
-end
\ No newline at end of file

Deleted: DietRB/trunk/lib/irb/io.rb
===================================================================
--- DietRB/trunk/lib/irb/io.rb	2010-10-08 11:05:56 UTC (rev 4728)
+++ DietRB/trunk/lib/irb/io.rb	2010-10-08 11:06:07 UTC (rev 4729)
@@ -1,12 +0,0 @@
-# for now use Readline by default
-require 'irb/io/readline'
-
-module IRB
-  class << self
-    attr_writer :io
-    
-    def io
-      @io ||= IRB::IO::Readline.new
-    end
-  end
-end
\ No newline at end of file

Modified: DietRB/trunk/lib/irb.rb
===================================================================
--- DietRB/trunk/lib/irb.rb	2010-10-08 11:05:56 UTC (rev 4728)
+++ DietRB/trunk/lib/irb.rb	2010-10-08 11:06:07 UTC (rev 4729)
@@ -5,12 +5,6 @@
 # Copyright (C) 2009-2010, Eloy Duran <eloy.de.enige at gmail.com>
 
 require 'irb/context'
-
-# require 'irb/io'
-# require 'irb/driver/tty'
-require 'irb/driver/readline'
-# require 'irb/driver/socket'
-
 require 'irb/source'
 require 'irb/version'
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/59fb5187/attachment.html>


More information about the macruby-changes mailing list