Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support helper method extension API #588

Open
st0012 opened this issue May 21, 2023 · 0 comments
Open

Support helper method extension API #588

st0012 opened this issue May 21, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@st0012
Copy link
Member

st0012 commented May 21, 2023

In #513, I proposed extension API for commands, but it doesn't cover all the extension needs. For example, Rails defines controller and helpers methods (and these methods too) for its Rails console, which are meant to be used as methods and be chained with other method calls. So they should not be treated as commands.

However, helper methods do share some common needs with commands, like:

  • Feature discovery, e.g. can be listed in the result of show_cmds (or help in the future)
  • Proper registration API and documentation (instead of manually including a module)

So I think we should provide (perhaps similar) extension for helper methods to fulfill such needs.

Details

Using Rails' controller helper as example:

module IRB
  module Helper
    class Controller < Helper::Base
      category "Rails"
      description "Gets a new instance of a controller object."

      def execute
        @controller ||= ApplicationController.new
      end
    end
  end
end

IRB::ExtendedCommandBundle.add_helper(:controller, IRB::Helper::Controller)
@st0012 st0012 added the enhancement New feature or request label May 21, 2023
@st0012 st0012 changed the title Support help method extension API Support helper method extension API May 26, 2023
@st0012 st0012 added this to the v2.0.0 milestone Jun 12, 2023
@st0012 st0012 self-assigned this Jul 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant