irb Questions

7

Solved

I'm new to ruby and I'm playing around with the IRB. I found that I can list methods of an object using the ".methods" method, and that self.methods sort of give me what I want (similar to Python'...
Rackrent asked 23/10, 2008 at 5:38

3

Solved

When I use Merb's built in console, I get tab auto-completion similar to a standard bash prompt. I find this useful and would like to enable it in non-merb IRB sessions. How do I get auto-completio...
Spleenful asked 5/9, 2009 at 0:30

1

Solved

I have Ruby 2.3.0p0 installed via rbenv, on OS X 10.11.4. Within an IRB session, history works fine. However, I cannot access IRB history across sessions. I tried my system Ruby, 2.0.0p648, and hi...
Emulous asked 16/6, 2016 at 0:12

1

Solved

While investigating an issue with irb on my Mac (OS X 10.11.5) I noticed /etc/irbrc. The first few lines follow: # Some default enhancements/settings for IRB, based on # http://wiki.rubygarden.org...
Send asked 3/6, 2016 at 14:51

2

Solved

I'm trying to load up console to interact with some of my rspec mocking helpers. I expected that running script/console test would load an env similar to when I run spec. However, this doesn't appe...
Chicalote asked 7/6, 2010 at 4:7

3

Solved

Why does the instance_variables method not show @var_one against the variable a? a = Object.new def a.my_eval; yield end a.my_eval { @var_one = 1 } a.instance_variables # => [] instance_varia...
Cartage asked 6/5, 2016 at 10:4

3

In my model I would like to check if the app is running inside IRB consol or as a website? class MyModel < ActiveRecord::Base def xmethod if !isIRBconsol self.user_id = UserSession.find.user...
Lashaunda asked 24/2, 2010 at 21:35

2

Solved

I'm using irb on OS X, and when I press option left/right (or META+B/F) the cursor moves to the next/previous word. But irb doesn't wont to treat dot (.) character as a word separator. I've tried ...
Borlase asked 10/10, 2012 at 15:26

2

Solved

I install ruby via rbenv-installer. When I use irb console, I can use history by pressing up and down on keyboard. And when I exited from console and start it again, I can't use prewious history....
Accad asked 21/6, 2012 at 11:20

1

Solved

I tried to use a Refinement in IRB (v0.9.6, Ruby 2.3.0): module Foo refine Object do def foo() "foo" end end end using Foo # => RuntimeError: main.using is permitted only at toplevel This...
Accountable asked 5/1, 2016 at 20:21

3

Solved

I want to use Rubymine's IDE debugger to debug a ruby process running in the command shell, as it is spawned, e.g. by "rails console". I've gotten great mileage out of the debugger when running th...
Illampu asked 16/1, 2012 at 21:41

6

I wonder if there's a way to load and/or use fixture in rails console. Actually, I'd like to create a user from my fixture users.yml to do some testing without having to go through all the "pain" o...
Prig asked 12/8, 2011 at 17:42

2

Solved

Probably something wrong with my setup: irb(main):001:0> truncate("Once upon a time in a world far far away", :length => 17) NoMethodError: undefined method `truncate' for main:Object from ...
Honna asked 17/10, 2012 at 20:28

2

Solved

I have an odd use-case where I need to issue "bundle install" (as a system() command) from a Rails application on another freshly-made Rails application without a Gemfile.lock. I'm aware that this...
Baucom asked 28/6, 2013 at 4:47

3

Solved

Ruby is preinstalled on my Mac and so I wanted to have a look at it. First thing I noticed, is that irb prompts >> instead of irb(main):001:0>. I can't find anything on how to change this with Goog...
Dulcine asked 6/2, 2009 at 12:22

2

I added to my .irbrc: IRB.conf[:PROMPT].reverse_merge!(:RAILS_ENV => {:PROMPT_I=>"#{current_app} #{rails_env} #{prompt} ", :PROMPT_N=>"#{current_app} #{rails_env} #{prompt} ", :PROMPT_S=&...
Heptode asked 24/1, 2012 at 18:49

3

Solved

I'm trying to use a Ruby gem called ice_cube in IRB, but it doesn't work: [~]$ rvm gemset create ice 'ice' gemset created (/home/joe/.rvm/gems/ruby-1.9.2-p320@ice). [~]$ rvm gemset use ice Using ...
Beckybecloud asked 17/7, 2012 at 19:0

2

I want to know the output stream being used by Ruby to print these things at the command-line: irb(main):001:0> a="test" => "test" irb(main):002:0> puts a test => nil irb(main):003:0&g...
Adela asked 24/1, 2014 at 22:18

2

Is there a way to display Active Record results in table format in the script/console environment?
Phototherapy asked 29/9, 2010 at 23:30

4

Solved

I am an absolute beginner in Ruby. I created a small ruby file, and it runs well when I run the command ruby "methods.rb". That means I am in the correct directory. But when I launch irb and run ...
Lani asked 2/10, 2013 at 16:36

1

Solved

My Rails site uses a certain gem which is really not very good. Every time I need to do something new I end up having to spend as much time adding features to the gem as I do adding code to the act...
Amundsen asked 23/8, 2013 at 17:25

3

Solved

I am trying to dynamically create local variables in Ruby using eval and mutate the local-variables array. I am doing this in IRB. eval "t = 2" local_variables # => [:_] eval "t" # => NameEr...
Marinate asked 24/7, 2013 at 19:7

1

Solved

In the Scala REPL if you evaluate something its value is stored in res{N}, as is discussed here: How can I access the last result in Scala REPL?. Is there a similar feature for the ruby REPL, or do...
Cognition asked 16/7, 2013 at 17:21

1

Solved

Sometimes when I run a scan '<tablename>. I see a continuous flood of data being printed because the table is big. I want to kill the process that print the data. Is there a way to do it othe...
Breastfeed asked 11/6, 2013 at 14:52

1

Solved

I frequently need to go on the Rails console with rails c. Then I run some statement which loops through records of a model. I need to output information, but all the SQL code gets littered through...

© 2022 - 2024 — McMap. All rights reserved.