mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 05:55:46 +02:00

(https://github.com/ruby/irb/pull/922)
* Remove internal-only methods from Command::Base
Command#ruby_args and Command#unwrap_string_literal are used for default command's argument backward compatibility.
Moved these methods to another module to avoid being used from custom commands.
* Update lib/irb/command/edit.rb
---------
7405a841e8
Co-authored-by: Stan Lo <stan001212@gmail.com>
62 lines
1.2 KiB
Ruby
62 lines
1.2 KiB
Ruby
# frozen_string_literal: true
|
|
#
|
|
# nop.rb -
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
|
#
|
|
|
|
module IRB
|
|
# :stopdoc:
|
|
|
|
module Command
|
|
class CommandArgumentError < StandardError; end
|
|
|
|
def self.extract_ruby_args(*args, **kwargs)
|
|
throw :EXTRACT_RUBY_ARGS, [args, kwargs]
|
|
end
|
|
|
|
class Base
|
|
class << self
|
|
def category(category = nil)
|
|
@category = category if category
|
|
@category
|
|
end
|
|
|
|
def description(description = nil)
|
|
@description = description if description
|
|
@description
|
|
end
|
|
|
|
def help_message(help_message = nil)
|
|
@help_message = help_message if help_message
|
|
@help_message
|
|
end
|
|
|
|
private
|
|
|
|
def highlight(text)
|
|
Color.colorize(text, [:BOLD, :BLUE])
|
|
end
|
|
end
|
|
|
|
def self.execute(irb_context, arg)
|
|
new(irb_context).execute(arg)
|
|
rescue CommandArgumentError => e
|
|
puts e.message
|
|
end
|
|
|
|
def initialize(irb_context)
|
|
@irb_context = irb_context
|
|
end
|
|
|
|
attr_reader :irb_context
|
|
|
|
def execute(arg)
|
|
#nop
|
|
end
|
|
end
|
|
|
|
Nop = Base
|
|
end
|
|
|
|
# :startdoc:
|
|
end
|