diff options
author | tomoya ishida <[email protected]> | 2024-04-11 01:52:47 +0900 |
---|---|---|
committer | git <[email protected]> | 2024-04-10 16:52:53 +0000 |
commit | 6a505d1b59cf326a8e004fc06e02f30222b17f3f (patch) | |
tree | 8ed520d1aee744158f154f4dd7733b6eb4d017e0 /lib/irb/ext | |
parent | 9f6deaa6888a423720b4b127b5314f0ad26cc2e6 (diff) |
[ruby/irb] Command implementation not by method
(https://github.com/ruby/irb/pull/824)
* Command is not a method
* Fix command test
* Implement non-method command name completion
* Add test for ExtendCommandBundle.def_extend_command
* Add helper method install test
* Remove spaces in command input parse
* Remove command arg unquote in help command
* Simplify Statement and handle execution in IRB::Irb
* Tweak require, const name
* Always install CommandBundle module to main object
* Remove considering local variable in command or expression check
* Remove unused method, tweak
* Remove outdated comment for help command arg
Co-authored-by: Stan Lo <[email protected]>
---------
https://github.com/ruby/irb/commit/8fb776e379
Co-authored-by: Stan Lo <[email protected]>
Diffstat (limited to 'lib/irb/ext')
-rw-r--r-- | lib/irb/ext/change-ws.rb | 8 | ||||
-rw-r--r-- | lib/irb/ext/workspaces.rb | 7 |
2 files changed, 6 insertions, 9 deletions
diff --git a/lib/irb/ext/change-ws.rb b/lib/irb/ext/change-ws.rb index 87fe03e23d..60e8afe31f 100644 --- a/lib/irb/ext/change-ws.rb +++ b/lib/irb/ext/change-ws.rb @@ -29,11 +29,9 @@ module IRB # :nodoc: return main end - replace_workspace(WorkSpace.new(_main[0])) - - if !(class<<main;ancestors;end).include?(ExtendCommandBundle) - main.extend ExtendCommandBundle - end + workspace = WorkSpace.new(_main[0]) + replace_workspace(workspace) + workspace.load_helper_methods_to_main end end end diff --git a/lib/irb/ext/workspaces.rb b/lib/irb/ext/workspaces.rb index 5a1edd89b7..da09faa83e 100644 --- a/lib/irb/ext/workspaces.rb +++ b/lib/irb/ext/workspaces.rb @@ -19,10 +19,9 @@ module IRB # :nodoc: @workspace_stack.push current_workspace, previous_workspace end else - @workspace_stack.push WorkSpace.new(workspace.binding, _main[0]) - if !(class<<main;ancestors;end).include?(ExtendCommandBundle) - main.extend ExtendCommandBundle - end + new_workspace = WorkSpace.new(workspace.binding, _main[0]) + @workspace_stack.push new_workspace + new_workspace.load_helper_methods_to_main end end |