Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
how do you create a large number of irb commands?
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="ghorner, post: 4639152"] I'm wondering what you all consider the best way for creating a large number of irb commands. By commands I'm referring to methods for the default irb object like irb,fg and jobs. Here are some of the different ways that come to mind: * Extend the default irb object with modules. * Include modules into the default irb object. However this has the nasty side effect of making those methods accessible to all objects. * Just define methods in the default irb object. Simple and seems to be the common way in irbrc's. * Use irb's internal command system i.e. self.def_extend_command() in [URL]http://github.com/rubyspec/matzruby/blob/9ca4e66f27e2563512afdd4c70afab34d80d513d/lib/irb/extend-command.rb[/URL] Seems like overkill. To me the only serious options are extending or just defining the method. By extending I get an ancestry trace on where commands came from which is important when dealing with a large number of commands. Also, if i do switch subsessions or workspaces I can just extend in needed functionality. Since defining methods in the irb object lacks the ancestry trace and the ability to reuse them in other context, my vote is for extending. Thoughts? Gabriel [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
how do you create a large number of irb commands?
Top