diff options
author | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-13 15:27:09 +0000 |
---|---|---|
committer | keiju <keiju@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-04-13 15:27:09 +0000 |
commit | 622b522047ea7bdb716ec87131d08400ba41e8b7 (patch) | |
tree | 44dc0e11d46e0083f3f1b0a5b1789051f2b07e13 /lib/irb/context.rb | |
parent | c56355fbdcaac7a55319f63416fcc19fbad89670 (diff) |
* bin/irb lib/irb.rb lib/irb/...: IRB 0.9.5.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/irb/context.rb')
-rw-r--r-- | lib/irb/context.rb | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/irb/context.rb b/lib/irb/context.rb index 01856cd2e7..043c12ade5 100644 --- a/lib/irb/context.rb +++ b/lib/irb/context.rb @@ -1,9 +1,9 @@ # # irb/context.rb - irb context -# $Release Version: 0.9$ +# $Release Version: 0.9.5$ # $Revision$ # $Date$ -# by Keiju ISHITSUKA([email protected]) +# by Keiju ISHITSUKA([email protected]) # # -- # @@ -19,7 +19,7 @@ module IRB # String -- File # other -- using this as InputMethod # - def initialize(irb, workspace = nil, input_method = nil) + def initialize(irb, workspace = nil, input_method = nil, output_method = nil) @irb = irb if workspace @workspace = workspace @@ -71,6 +71,13 @@ module IRB else @io = input_method end + self.save_history = IRB.conf[:SAVE_HISTORY] if IRB.conf[:SAVE_HISTORY] + + if output_method + @output_method = output_method + else + @output_method = StdioOutputMethod.new + end @verbose = IRB.conf[:VERBOSE] @echo = IRB.conf[:ECHO] @@ -96,13 +103,14 @@ module IRB attr_accessor :irb_name attr_accessor :irb_path - attr_accessor :use_readline + attr_reader :use_readline attr_reader :inspect_mode attr_reader :prompt_mode attr_accessor :prompt_i attr_accessor :prompt_s attr_accessor :prompt_c + attr_accessor :prompt_n attr_accessor :auto_indent_mode attr_accessor :return_format @@ -141,6 +149,7 @@ module IRB def set_last_value(value) @last_value = value + @workspace.evaluate self, "_ = IRB.CurrentContext.last_value" end attr_reader :irb_name @@ -151,6 +160,7 @@ module IRB @prompt_i = pconf[:PROMPT_I] @prompt_s = pconf[:PROMPT_S] @prompt_c = pconf[:PROMPT_C] + @prompt_n = pconf[:PROMPT_N] @return_format = pconf[:RETURN] if ai = pconf.include?(:AUTO_INDENT) @auto_indent_mode = ai @@ -177,7 +187,6 @@ module IRB @inspect_mode end - undef use_readline= def use_readline=(opt) @use_readline = opt print "use readline module\n" if @use_readline |