mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
irb: Define extension command on the given object
This commit is contained in:
parent
37987d9994
commit
4b6e3f7b82
1 changed files with 3 additions and 3 deletions
|
@ -177,9 +177,9 @@ module IRB # :nodoc:
|
|||
args << "&block"
|
||||
args = args.join(", ")
|
||||
line = __LINE__; eval %[
|
||||
unless self.singleton_class.class_variable_defined?(:@@#{cmd_name}_)
|
||||
self.singleton_class.class_variable_set(:@@#{cmd_name}_, true)
|
||||
def #{cmd_name}_(\#{args})
|
||||
unless singleton_class.class_variable_defined?(:@@#{cmd_name}_)
|
||||
singleton_class.class_variable_set(:@@#{cmd_name}_, true)
|
||||
def self.#{cmd_name}_(\#{args})
|
||||
ExtendCommand::#{cmd_class}.execute(irb_context, \#{args})
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue