Class: IRB::Kit::Handlers::ConstantEditor

Inherits:
Abstract
  • Object
show all
Defined in:
lib/irb/kit/handlers/constant_editor.rb

Overview

Handles editing of constant source code.

Instance Method Summary collapse

Constructor Details

#initialize(editor: Editor.new) ⇒ ConstantEditor

Returns a new instance of ConstantEditor.



8
9
10
11
# File 'lib/irb/kit/handlers/constant_editor.rb', line 8

def initialize(editor: Editor.new, **)
  @editor = editor
  super(**)
end

Instance Method Details

#call(name) ⇒ Object



13
14
15
16
17
# File 'lib/irb/kit/handlers/constant_editor.rb', line 13

def call name
  editor.call(*Object.const_source_location(name))
rescue NameError
  io.puts "ERROR (invalid constant): #{name.inspect}."
end