Sha256: 944bbfeb9d5fc590b95cd50ee6f6578f52acedc8d734ac09e47b173314ab9f7d
Contents?: true
Size: 1.79 KB
Versions: 14
Compression:
Stored size: 1.79 KB
Contents
module Redcar class REPL class ClojureMirror def self.load_clojure_dependencies unless @loaded require File.dirname(__FILE__) + "/../../vendor/clojure.jar" require File.dirname(__FILE__) + "/../../vendor/clojure-contrib.jar" require File.dirname(__FILE__) + "/../../vendor/org-enclojure-repl-server.jar" require File.dirname(__FILE__) + "/../../vendor/enclojure-wrapper.jar" import 'redcar.repl.Wrapper' @loaded = true end end include Redcar::REPL::ReplMirror def initialize ClojureMirror.load_clojure_dependencies # required by ReplMirror @prompt = "=>" @repl_wrapper = Wrapper.new @mutex = Mutex.new @history = "# Clojure REPL\n" @thread = Thread.new do loop do str = @repl_wrapper.getResult @mutex.synchronize do @history += "\n" if @history != "" @history += str end Redcar.update_gui do notify_listeners(:change) end end end end def title "Clojure REPL" end def grammar_name "Clojure REPL" end # Get the complete history as a pretty formatted string. # # @return [String] def read @mutex.synchronize do @history end end def clear_history @mutex.synchronize do @history = @history.split("\n").last end notify_listeners(:change) end private def send_to_repl expr @mutex.synchronize do @history += expr end @repl_wrapper.sendToRepl(expr) end end end end
Version data entries
14 entries across 14 versions & 1 rubygems