Class: IRB::Command::Edit
Do not use. This class is for internal use only.
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
self,
Base
|
|
Instance Chain:
self,
RubyArgsExtractor ,
Base
|
|
Inherits: |
IRB::Command::Base
|
Defined in: | lib/irb/command/edit.rb |
Class Method Summary
Base
- Inherited
Instance Attribute Summary
Base
- Inherited
Instance Method Summary
RubyArgsExtractor
- Included
Base
- Inherited
Constructor Details
This class inherits a constructor from IRB::Command::Base
Instance Method Details
#execute(arg)
[ GitHub ]# File 'lib/irb/command/edit.rb', line 32
def execute(arg) # Accept string literal for backward compatibility path = unwrap_string_literal(arg) if path.nil? path = @irb_context.irb_path elsif !File.exist?(path) source = SourceFinder.new(@irb_context).find_source(path) if source&.file_exist? && !source.binary_file? path = source.file end end unless File.exist?(path) puts "Can not find file: #{path}" return end if editor = (ENV['VISUAL'] || ENV['EDITOR']) puts "command: '#{editor}'" puts " path: #{path}" system(*Shellwords.split(editor), path) else puts "Can not find editor setting: ENV['VISUAL'] or ENV['EDITOR']" end end