lib/irb/command/base.rb in irb-1.12.0 vs lib/irb/command/base.rb in irb-1.13.0
- old
+ new
@@ -8,10 +8,14 @@
# :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
@@ -27,33 +31,27 @@
@help_message
end
private
- def string_literal?(args)
- sexp = Ripper.sexp(args)
- sexp && sexp.size == 2 && sexp.last&.first&.first == :string_literal
- end
-
def highlight(text)
Color.colorize(text, [:BOLD, :BLUE])
end
end
- def self.execute(irb_context, *opts, **kwargs, &block)
- command = new(irb_context)
- command.execute(*opts, **kwargs, &block)
+ 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(*opts)
+ def execute(arg)
#nop
end
end
Nop = Base