ipython like interpreter for ruby

2024/10/14 13:22:59

I come from python background and am learning ruby. IPython is really awesome. I am new to ruby now, and wanted to have some sort of ipython things. As of now am having tough time, going along ruby lines. Seems to be slightly irritating, when pressing tab does not complete things. I hit upon this question and followed the first answer, with max upvotes.

It said to do require 'irb/completion'

I did the same, and got following error:

LoadError: cannot load such file -- readlinefrom /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'from (irb):1from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

I then tried require 'completion' which eventually led to the following error:

LoadError: cannot load such file -- completionfrom /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'from (irb):3from /home/letsrock/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

Let me know whats wrong, i am using ubuntu 11.04.

Answer

Give a look at Pry which is an alternative to IRB.

It has:

Many convenience commands inspired by IPython, Smalltalk and other advanced REPLs

A few of the features include:

  • Source code browsing (including core C source with the pry-doc gem)
  • Navigation around state (cd, ls and friends)
  • Documentation browsing
  • Live help system
  • Open methods in editors (edit-method Class#method)
  • Syntax highlighting
  • Command shell integration (start editors, run git, and rake from within Pry)
  • Gist integration
  • Runtime invocation (use Pry as a developer console or debugger)
  • Ability to view and replay history

It is also very actively developed with version 0.9.10 released on 7/14/2012.

https://en.xdnf.cn/q/117953.html

Related Q&A

Django dynamic verification form

Im trying to create a verification form in Django that presents a user with a list of choices, only one of which is valid.For example, for a user whose favourite pizza toppings includes pineapple and r…

Any method to denote object assignment?

Ive been studying magic methods in Python, and have been wondering if theres a way to outline the specific action of:a = MyClass(*params).method()versus:MyClass(*params).method()In the sense that, perh…

Delete lines found in file with many lines

I have an Excel file (.xls) with many lines (1008), and Im looking for lines that have anything with 2010. For example, there is a line that contains 01/06/2010, so this line would be deleted, leaving …

Combining semaphore and time limiting in python-trio with asks http request

Im trying to use Python in an async manner in order to speed up my requests to a server. The server has a slow response time (often several seconds, but also sometimes faster than a second), but works …

Import of SWIG python module fails with apache

Importing a python mdule throws an exception in django when I run with apache. The same source code works fine with the django development server. I can also import the module from the command line. Th…

Pro-Football-Reference Team Stats XPath

I am using the scrapy shell on this page Pittsburgh Steelers at New England Patriots - September 10th, 2015 to pull individual team stats. For example, I want to pull total yards for the away team (46…

How to delete the last item of a collection in mongodb

I made a program with python and mongodb to do some diaries. Like thisSometimes I want to delete the last sentence, just by typing "delete!" But I dont know how to delete in a samrt way. I do…

Python+kivy+SQLite: How to set label initial value and how to update label text?

everyone,I want to use kivy+Python to display items from a db file. To this purpose I have asked a question before: Python+kivy+SQLite: How to use them together The App in the link contains one screen.…

how to debug ModelMultipleChoiceField [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed 7 years ago.Improve…

Standardization/preprocessing for 4-dimensional array

Id like to standardize my data to zero mean and std = 1. The shape of my data is 28783x4x24x7, and it can thought of as 28783 images with 4 channels and dimensions 24x7. The channels need to be standar…