lib/irb/command/base.rb in irb-1.14.0 vs lib/irb/command/base.rb in irb-1.14.1

- old
+ new

@@ -8,12 +8,14 @@ # :stopdoc: module Command class CommandArgumentError < StandardError; end - def self.extract_ruby_args(*args, **kwargs) - throw :EXTRACT_RUBY_ARGS, [args, kwargs] + class << self + def extract_ruby_args(*args, **kwargs) + throw :EXTRACT_RUBY_ARGS, [args, kwargs] + end end class Base class << self def category(category = nil) @@ -29,20 +31,20 @@ def help_message(help_message = nil) @help_message = help_message if help_message @help_message end + def execute(irb_context, arg) + new(irb_context).execute(arg) + rescue CommandArgumentError => e + puts e.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