summaryrefslogtreecommitdiff
path: root/lib/irb/context.rb
diff options
context:
space:
mode:
authortomoya ishida <[email protected]>2024-02-13 03:38:27 +0900
committergit <[email protected]>2024-02-12 18:38:30 +0000
commit7af97dc71fd6790a3f4ffe47dcc5720b675f6b6b ()
tree746868021ac678da2ab27261d88794a1daf9e2d2 /lib/irb/context.rb
parente878bbd641f255b5d8f9e99b84ff8082a5b7fdaf (diff)
[ruby/irb] Powerup show_source by enabling RubyVM.keep_script_lines
(https://.com/ruby/irb/pull/862) * Powerup show_source by enabling RubyVM.keep_script_lines * Add file_content field to avoid reading file twice while show_source * Change path passed to eval, don't change irb_path. * Encapsulate source coloring logic and binary file check insode class Source * Add edit command testcase when irb_path does not exist * Memoize irb_path existence to reduce file existence check calculating eval_path https://.com/ruby/irb/commit/239683a937
-rw-r--r--lib/irb/context.rb12
1 files changed, 10 insertions, 2 deletions
@@ -557,7 +557,7 @@ module IRB
if IRB.conf[:MEASURE] && !IRB.conf[:MEASURE_CALLBACKS].empty?
last_proc = proc do
- result = @workspace.evaluate(line, irb_path, line_no)
end
IRB.conf[:MEASURE_CALLBACKS].inject(last_proc) do |chain, item|
_name, callback, arg = item
@@ -568,12 +568,20 @@ module IRB
end
end.call
else
- result = @workspace.evaluate(line, irb_path, line_no)
end
set_last_value(result)
end
def inspect_last_value # :nodoc:
@inspect_method.inspect_value(@last_value)
end