2015-12-16 00:07:31 -05:00
|
|
|
# frozen_string_literal: false
|
2001-04-30 13:38:21 -04:00
|
|
|
#
|
2009-03-05 22:56:38 -05:00
|
|
|
# irb/extend-command.rb - irb extend command
|
2009-07-07 07:36:20 -04:00
|
|
|
# $Release Version: 0.9.6$
|
2001-04-30 13:38:21 -04:00
|
|
|
# $Revision$
|
2005-04-13 11:27:09 -04:00
|
|
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
2001-04-30 13:38:21 -04:00
|
|
|
#
|
|
|
|
# --
|
|
|
|
#
|
2009-03-05 22:56:38 -05:00
|
|
|
#
|
2001-04-30 13:38:21 -04:00
|
|
|
#
|
2012-12-13 00:22:30 -05:00
|
|
|
module IRB # :nodoc:
|
2012-12-21 00:45:50 -05:00
|
|
|
# Installs the default irb extensions command bundle.
|
2002-07-09 07:17:17 -04:00
|
|
|
module ExtendCommandBundle
|
2012-12-21 00:45:50 -05:00
|
|
|
EXCB = ExtendCommandBundle # :nodoc:
|
2001-04-30 13:38:21 -04:00
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# See #install_alias_method.
|
2002-07-09 07:17:17 -04:00
|
|
|
NO_OVERRIDE = 0
|
2012-12-21 00:45:50 -05:00
|
|
|
# See #install_alias_method.
|
2002-07-09 07:17:17 -04:00
|
|
|
OVERRIDE_PRIVATE_ONLY = 0x01
|
2012-12-21 00:45:50 -05:00
|
|
|
# See #install_alias_method.
|
2002-07-09 07:17:17 -04:00
|
|
|
OVERRIDE_ALL = 0x02
|
2001-04-30 13:38:21 -04:00
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Quits the current irb context
|
|
|
|
#
|
|
|
|
# +ret+ is the optional signal or message to send to Context#exit
|
|
|
|
#
|
|
|
|
# Same as <code>IRB.CurrentContext.exit</code>.
|
2002-07-09 07:17:17 -04:00
|
|
|
def irb_exit(ret = 0)
|
|
|
|
irb_context.exit(ret)
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|
|
|
|
|
2012-12-13 00:22:30 -05:00
|
|
|
# Displays current configuration.
|
|
|
|
#
|
2019-12-19 22:19:45 -05:00
|
|
|
# Modifying the configuration is achieved by sending a message to IRB.conf.
|
2001-04-30 13:38:21 -04:00
|
|
|
def irb_context
|
2002-07-09 07:17:17 -04:00
|
|
|
IRB.CurrentContext
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|
|
|
|
|
2002-07-09 07:17:17 -04:00
|
|
|
@ALIASES = [
|
|
|
|
[:context, :irb_context, NO_OVERRIDE],
|
|
|
|
[:conf, :irb_context, NO_OVERRIDE],
|
|
|
|
[:irb_quit, :irb_exit, OVERRIDE_PRIVATE_ONLY],
|
|
|
|
[:exit, :irb_exit, OVERRIDE_PRIVATE_ONLY],
|
|
|
|
[:quit, :irb_exit, OVERRIDE_PRIVATE_ONLY],
|
|
|
|
]
|
|
|
|
|
|
|
|
@EXTEND_COMMANDS = [
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_current_working_workspace, :CurrentWorkingWorkspace, "cmd/chws",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:irb_print_working_workspace, OVERRIDE_ALL],
|
|
|
|
[:irb_cwws, OVERRIDE_ALL],
|
|
|
|
[:irb_pwws, OVERRIDE_ALL],
|
|
|
|
[:cwws, NO_OVERRIDE],
|
|
|
|
[:pwws, NO_OVERRIDE],
|
|
|
|
[:irb_current_working_binding, OVERRIDE_ALL],
|
|
|
|
[:irb_print_working_binding, OVERRIDE_ALL],
|
|
|
|
[:irb_cwb, OVERRIDE_ALL],
|
|
|
|
[:irb_pwb, OVERRIDE_ALL],
|
|
|
|
],
|
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_change_workspace, :ChangeWorkspace, "cmd/chws",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:irb_chws, OVERRIDE_ALL],
|
|
|
|
[:irb_cws, OVERRIDE_ALL],
|
|
|
|
[:chws, NO_OVERRIDE],
|
|
|
|
[:cws, NO_OVERRIDE],
|
|
|
|
[:irb_change_binding, OVERRIDE_ALL],
|
|
|
|
[:irb_cb, OVERRIDE_ALL],
|
|
|
|
[:cb, NO_OVERRIDE],
|
|
|
|
],
|
2002-07-09 07:17:17 -04:00
|
|
|
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_workspaces, :Workspaces, "cmd/pushws",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:workspaces, NO_OVERRIDE],
|
|
|
|
[:irb_bindings, OVERRIDE_ALL],
|
|
|
|
[:bindings, NO_OVERRIDE],
|
|
|
|
],
|
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_push_workspace, :PushWorkspace, "cmd/pushws",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:irb_pushws, OVERRIDE_ALL],
|
|
|
|
[:pushws, NO_OVERRIDE],
|
|
|
|
[:irb_push_binding, OVERRIDE_ALL],
|
|
|
|
[:irb_pushb, OVERRIDE_ALL],
|
|
|
|
[:pushb, NO_OVERRIDE],
|
|
|
|
],
|
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_pop_workspace, :PopWorkspace, "cmd/pushws",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:irb_popws, OVERRIDE_ALL],
|
|
|
|
[:popws, NO_OVERRIDE],
|
|
|
|
[:irb_pop_binding, OVERRIDE_ALL],
|
|
|
|
[:irb_popb, OVERRIDE_ALL],
|
|
|
|
[:popb, NO_OVERRIDE],
|
|
|
|
],
|
2002-07-09 07:17:17 -04:00
|
|
|
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_load, :Load, "cmd/load"],
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_require, :Require, "cmd/load"],
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_source, :Source, "cmd/load",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:source, NO_OVERRIDE],
|
|
|
|
],
|
2002-07-09 07:17:17 -04:00
|
|
|
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb, :IrbCommand, "cmd/subirb"],
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_jobs, :Jobs, "cmd/subirb",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:jobs, NO_OVERRIDE],
|
|
|
|
],
|
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_fg, :Foreground, "cmd/subirb",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:fg, NO_OVERRIDE],
|
|
|
|
],
|
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_kill, :Kill, "cmd/subirb",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:kill, OVERRIDE_PRIVATE_ONLY],
|
|
|
|
],
|
2004-02-05 19:16:50 -05:00
|
|
|
|
2019-08-27 12:07:27 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_help, :Help, "cmd/help",
|
2019-08-27 12:07:27 -04:00
|
|
|
[:help, NO_OVERRIDE],
|
|
|
|
],
|
2005-04-13 11:27:09 -04:00
|
|
|
|
2020-04-27 05:27:19 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_info, :Info, "cmd/info"
|
2020-04-27 05:27:19 -04:00
|
|
|
],
|
|
|
|
|
2021-03-18 03:28:04 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_ls, :Ls, "cmd/ls",
|
2021-03-18 03:28:04 -04:00
|
|
|
[:ls, NO_OVERRIDE],
|
|
|
|
],
|
|
|
|
|
2020-08-14 17:36:24 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_measure, :Measure, "cmd/measure",
|
2021-03-18 06:06:22 -04:00
|
|
|
[:measure, NO_OVERRIDE],
|
2021-03-18 04:18:42 -04:00
|
|
|
],
|
|
|
|
|
2021-04-01 01:49:51 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_show_source, :ShowSource, "cmd/show_source",
|
2021-04-01 01:49:51 -04:00
|
|
|
[:show_source, NO_OVERRIDE],
|
|
|
|
],
|
|
|
|
|
2021-03-18 04:18:42 -04:00
|
|
|
[
|
2022-01-17 06:45:16 -05:00
|
|
|
:irb_whereami, :Whereami, "cmd/whereami",
|
2021-03-18 04:18:42 -04:00
|
|
|
[:whereami, NO_OVERRIDE],
|
2020-08-14 17:36:24 -04:00
|
|
|
],
|
|
|
|
|
2002-07-09 07:17:17 -04:00
|
|
|
]
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Installs the default irb commands:
|
|
|
|
#
|
|
|
|
# +irb_current_working_workspace+:: Context#main
|
|
|
|
# +irb_change_workspace+:: Context#change_workspace
|
|
|
|
# +irb_workspaces+:: Context#workspaces
|
|
|
|
# +irb_push_workspace+:: Context#push_workspace
|
|
|
|
# +irb_pop_workspace+:: Context#pop_workspace
|
|
|
|
# +irb_load+:: #irb_load
|
|
|
|
# +irb_require+:: #irb_require
|
|
|
|
# +irb_source+:: IrbLoader#source_file
|
|
|
|
# +irb+:: IRB.irb
|
|
|
|
# +irb_jobs+:: JobManager
|
|
|
|
# +irb_fg+:: JobManager#switch
|
|
|
|
# +irb_kill+:: JobManager#kill
|
|
|
|
# +irb_help+:: IRB@Command+line+options
|
2006-08-08 11:17:06 -04:00
|
|
|
def self.install_extend_commands
|
2002-07-09 07:17:17 -04:00
|
|
|
for args in @EXTEND_COMMANDS
|
2014-08-08 21:36:49 -04:00
|
|
|
def_extend_command(*args)
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Evaluate the given +cmd_name+ on the given +cmd_class+ Class.
|
|
|
|
#
|
|
|
|
# Will also define any given +aliases+ for the method.
|
|
|
|
#
|
|
|
|
# The optional +load_file+ parameter will be required within the method
|
|
|
|
# definition.
|
2006-08-08 11:17:06 -04:00
|
|
|
def self.def_extend_command(cmd_name, cmd_class, load_file = nil, *aliases)
|
2002-07-09 07:17:17 -04:00
|
|
|
case cmd_class
|
|
|
|
when Symbol
|
2014-08-08 21:36:49 -04:00
|
|
|
cmd_class = cmd_class.id2name
|
2002-07-09 07:17:17 -04:00
|
|
|
when String
|
|
|
|
when Class
|
2014-08-08 21:36:49 -04:00
|
|
|
cmd_class = cmd_class.name
|
2002-07-09 07:17:17 -04:00
|
|
|
end
|
2001-04-30 13:38:21 -04:00
|
|
|
|
2002-07-09 07:17:17 -04:00
|
|
|
if load_file
|
2021-03-18 03:28:04 -04:00
|
|
|
kwargs = ", **kwargs" if RUBY_ENGINE == "ruby" && RUBY_VERSION >= "2.7.0"
|
2014-08-08 21:36:49 -04:00
|
|
|
line = __LINE__; eval %[
|
2021-03-18 03:28:04 -04:00
|
|
|
def #{cmd_name}(*opts#{kwargs}, &b)
|
2022-01-17 06:45:16 -05:00
|
|
|
require_relative "#{load_file}"
|
2014-08-08 21:36:49 -04:00
|
|
|
arity = ExtendCommand::#{cmd_class}.instance_method(:execute).arity
|
|
|
|
args = (1..(arity < 0 ? ~arity : arity)).map {|i| "arg" + i.to_s }
|
2021-03-18 03:28:04 -04:00
|
|
|
args << "*opts#{kwargs}" if arity < 0
|
2014-08-08 21:36:49 -04:00
|
|
|
args << "&block"
|
|
|
|
args = args.join(", ")
|
|
|
|
line = __LINE__; eval %[
|
2020-12-20 05:35:59 -05:00
|
|
|
unless singleton_class.class_variable_defined?(:@@#{cmd_name}_)
|
|
|
|
singleton_class.class_variable_set(:@@#{cmd_name}_, true)
|
|
|
|
def self.#{cmd_name}_(\#{args})
|
2020-04-28 04:07:27 -04:00
|
|
|
ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
|
|
|
|
end
|
2014-08-08 21:36:49 -04:00
|
|
|
end
|
|
|
|
], nil, __FILE__, line
|
2021-03-18 03:28:04 -04:00
|
|
|
__send__ :#{cmd_name}_, *opts#{kwargs}, &b
|
2014-08-08 21:36:49 -04:00
|
|
|
end
|
|
|
|
], nil, __FILE__, line
|
2002-07-09 07:17:17 -04:00
|
|
|
else
|
2014-08-08 21:36:49 -04:00
|
|
|
line = __LINE__; eval %[
|
|
|
|
def #{cmd_name}(*opts, &b)
|
|
|
|
ExtendCommand::#{cmd_class}.execute(irb_context, *opts, &b)
|
|
|
|
end
|
|
|
|
], nil, __FILE__, line
|
2002-07-09 07:17:17 -04:00
|
|
|
end
|
2001-04-30 13:38:21 -04:00
|
|
|
|
2002-07-09 07:17:17 -04:00
|
|
|
for ali, flag in aliases
|
2014-08-08 21:36:49 -04:00
|
|
|
@ALIASES.push [ali, cmd_name, flag]
|
2002-07-09 07:17:17 -04:00
|
|
|
end
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Installs alias methods for the default irb commands, see
|
|
|
|
# ::install_extend_commands.
|
2002-07-09 07:17:17 -04:00
|
|
|
def install_alias_method(to, from, override = NO_OVERRIDE)
|
2001-04-30 13:38:21 -04:00
|
|
|
to = to.id2name unless to.kind_of?(String)
|
|
|
|
from = from.id2name unless from.kind_of?(String)
|
|
|
|
|
|
|
|
if override == OVERRIDE_ALL or
|
2014-08-08 21:36:49 -04:00
|
|
|
(override == OVERRIDE_PRIVATE_ONLY) && !respond_to?(to) or
|
|
|
|
(override == NO_OVERRIDE) && !respond_to?(to, true)
|
|
|
|
target = self
|
|
|
|
(class << self; self; end).instance_eval{
|
|
|
|
if target.respond_to?(to, true) &&
|
|
|
|
!target.respond_to?(EXCB.irb_original_method_name(to), true)
|
|
|
|
alias_method(EXCB.irb_original_method_name(to), to)
|
|
|
|
end
|
|
|
|
alias_method to, from
|
|
|
|
}
|
2001-04-30 13:38:21 -04:00
|
|
|
else
|
2021-12-05 18:57:56 -05:00
|
|
|
Kernel.print "irb: warn: can't alias #{to} from #{from}.\n"
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
def self.irb_original_method_name(method_name) # :nodoc:
|
2001-04-30 13:38:21 -04:00
|
|
|
"irb_" + method_name + "_org"
|
|
|
|
end
|
2002-07-09 07:17:17 -04:00
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Installs alias methods for the default irb commands on the given object
|
|
|
|
# using #install_alias_method.
|
2006-08-08 11:17:06 -04:00
|
|
|
def self.extend_object(obj)
|
2009-12-04 20:18:28 -05:00
|
|
|
unless (class << obj; ancestors; end).include?(EXCB)
|
2014-08-08 21:36:49 -04:00
|
|
|
super
|
|
|
|
for ali, com, flg in @ALIASES
|
|
|
|
obj.install_alias_method(ali, com, flg)
|
|
|
|
end
|
2002-07-09 07:17:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
install_extend_commands
|
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Extends methods for the Context module
|
2002-07-09 07:17:17 -04:00
|
|
|
module ContextExtender
|
2012-12-21 00:45:50 -05:00
|
|
|
CE = ContextExtender # :nodoc:
|
2002-07-09 07:17:17 -04:00
|
|
|
|
|
|
|
@EXTEND_COMMANDS = [
|
2022-01-17 06:45:16 -05:00
|
|
|
[:eval_history=, "ext/history.rb"],
|
|
|
|
[:use_tracer=, "ext/tracer.rb"],
|
|
|
|
[:use_loader=, "ext/use-loader.rb"],
|
|
|
|
[:save_history=, "ext/save-history.rb"],
|
2002-07-09 07:17:17 -04:00
|
|
|
]
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Installs the default context extensions as irb commands:
|
|
|
|
#
|
|
|
|
# Context#eval_history=:: +irb/ext/history.rb+
|
|
|
|
# Context#use_tracer=:: +irb/ext/tracer.rb+
|
|
|
|
# Context#use_loader=:: +irb/ext/use-loader.rb+
|
|
|
|
# Context#save_history=:: +irb/ext/save-history.rb+
|
2006-08-08 11:17:06 -04:00
|
|
|
def self.install_extend_commands
|
2002-07-09 07:17:17 -04:00
|
|
|
for args in @EXTEND_COMMANDS
|
2014-08-08 21:36:49 -04:00
|
|
|
def_extend_command(*args)
|
2002-07-09 07:17:17 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Evaluate the given +command+ from the given +load_file+ on the Context
|
|
|
|
# module.
|
|
|
|
#
|
|
|
|
# Will also define any given +aliases+ for the method.
|
2006-08-08 11:17:06 -04:00
|
|
|
def self.def_extend_command(cmd_name, load_file, *aliases)
|
2009-12-04 20:18:28 -05:00
|
|
|
line = __LINE__; Context.module_eval %[
|
2002-07-09 07:17:17 -04:00
|
|
|
def #{cmd_name}(*opts, &b)
|
2014-08-08 21:36:49 -04:00
|
|
|
Context.module_eval {remove_method(:#{cmd_name})}
|
2022-01-17 06:45:16 -05:00
|
|
|
require_relative "#{load_file}"
|
2020-10-27 00:42:52 -04:00
|
|
|
__send__ :#{cmd_name}, *opts, &b
|
2014-08-08 21:36:49 -04:00
|
|
|
end
|
|
|
|
for ali in aliases
|
|
|
|
alias_method ali, cmd_name
|
|
|
|
end
|
2009-12-04 20:18:28 -05:00
|
|
|
], __FILE__, line
|
2002-07-09 07:17:17 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
CE.install_extend_commands
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|
2005-04-13 11:27:09 -04:00
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# A convenience module for extending Ruby methods.
|
2005-04-13 11:27:09 -04:00
|
|
|
module MethodExtender
|
2012-12-21 00:45:50 -05:00
|
|
|
# Extends the given +base_method+ with a prefix call to the given
|
|
|
|
# +extend_method+.
|
2005-04-13 11:27:09 -04:00
|
|
|
def def_pre_proc(base_method, extend_method)
|
|
|
|
base_method = base_method.to_s
|
|
|
|
extend_method = extend_method.to_s
|
|
|
|
|
|
|
|
alias_name = new_alias_name(base_method)
|
|
|
|
module_eval %[
|
|
|
|
alias_method alias_name, base_method
|
|
|
|
def #{base_method}(*opts)
|
2020-10-27 00:42:52 -04:00
|
|
|
__send__ :#{extend_method}, *opts
|
|
|
|
__send__ :#{alias_name}, *opts
|
2014-08-08 21:36:49 -04:00
|
|
|
end
|
2005-04-13 11:27:09 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Extends the given +base_method+ with a postfix call to the given
|
|
|
|
# +extend_method+.
|
2005-04-13 11:27:09 -04:00
|
|
|
def def_post_proc(base_method, extend_method)
|
|
|
|
base_method = base_method.to_s
|
|
|
|
extend_method = extend_method.to_s
|
|
|
|
|
|
|
|
alias_name = new_alias_name(base_method)
|
|
|
|
module_eval %[
|
|
|
|
alias_method alias_name, base_method
|
|
|
|
def #{base_method}(*opts)
|
2020-10-27 00:42:52 -04:00
|
|
|
__send__ :#{alias_name}, *opts
|
|
|
|
__send__ :#{extend_method}, *opts
|
2014-08-08 21:36:49 -04:00
|
|
|
end
|
2005-04-13 11:27:09 -04:00
|
|
|
]
|
|
|
|
end
|
|
|
|
|
2012-12-21 00:45:50 -05:00
|
|
|
# Returns a unique method name to use as an alias for the given +name+.
|
|
|
|
#
|
|
|
|
# Usually returns <code>#{prefix}#{name}#{postfix}<num></code>, example:
|
|
|
|
#
|
|
|
|
# new_alias_name('foo') #=> __alias_of__foo__
|
|
|
|
# def bar; end
|
|
|
|
# new_alias_name('bar') #=> __alias_of__bar__2
|
2005-04-13 11:27:09 -04:00
|
|
|
def new_alias_name(name, prefix = "__alias_of__", postfix = "__")
|
|
|
|
base_name = "#{prefix}#{name}#{postfix}"
|
|
|
|
all_methods = instance_methods(true) + private_instance_methods(true)
|
|
|
|
same_methods = all_methods.grep(/^#{Regexp.quote(base_name)}[0-9]*$/)
|
|
|
|
return base_name if same_methods.empty?
|
|
|
|
no = same_methods.size
|
|
|
|
while !same_methods.include?(alias_name = base_name + no)
|
2014-08-08 21:36:49 -04:00
|
|
|
no += 1
|
2005-04-13 11:27:09 -04:00
|
|
|
end
|
|
|
|
alias_name
|
|
|
|
end
|
|
|
|
end
|
2001-04-30 13:38:21 -04:00
|
|
|
end
|