irb Questions
1
Solved
Starting up an interactive Ruby shell in the Terminal ('irb'), one can continue to open up irb subshells endlessly. What's the point of this?
4
Might sound like a newbie question (and it is since I am new to Ruby and IRB) but is there a way to save the commands you did in IRB to file? I am playing with WATIR and would love to save all my i...
7
I'm having a really noob problem with importing files in Ruby. I'm making a Ruby app in Windows XP. All the class files for the app are in "C:/Documents/Prgm/Surveyor_Ruby/lib". But when I require ...
Linneman asked 9/10, 2010 at 22:39
1
Solved
For example, I want to say b = double("book") in irb and play with the result.
In irb if I say
require 'rspec'
b = double("book")
I get an error. Ideas?
1
Solved
Long story short, I was writing a method that included an options argument, that will do certain stuff if the value for the key :if, evaluated to true. When I trying the hash in IRB using the new s...
Dorinda asked 19/2, 2013 at 20:24
1
Solved
I'd want to use [1,2,3].should include(1) in irb. I tried:
~$ irb
1.9.3p362 :001 > require 'rspec/expectations'
=> true
1.9.3p362 :002 > include RSpec::Matchers
=> Object
1.9.3p362...
Mannequin asked 7/2, 2013 at 10:38
1
Solved
A particular line of code results in no output, and IRB exits out of the >> prompt. I am not looking to exit IRB, but just to exit to a state preceding the line of code that caused the ...
3
Solved
Considering that everything in Ruby is an object and we can open irb and type things like 4.class and "Text".class to see from which class an object is, why do if.class and unless.class give no ret...
1
I got a regex in my code, which is to match pattern of url and threw error:
/^(http|https):\/\/([\w-]+\.)+[\w-]+([\w- .\/?%&=]*)?$/
The error was "empty range in char class error". I found t...
3
Solved
Possible Duplicate:
Is there a way to get out of a “hung” state in IRB?
I am using IRB. When I am coding I noticed that I get "stuck" when the line ends with "/":
irb(main):057:0/
...
3
Solved
Update: I found almost exact similar question, yet it has slightly different prerequisites and thus doesn't help much.
Given:
MacOS Lion 10.7.3
rvm 1.14.2
ruby 1.9.3p194 (2012-04-20 revision 354...
3
Solved
Possible Duplicate:
How to run ruby files?
I am starting to learn Ruby and having a hard time running the Ruby classes in the Terminal.
I created a class in the Sublime Text editor, ...
Hippocras asked 16/10, 2012 at 18:2
1
I have a simple class in a file in lib/simple.rb.
In the console (rails c) I have a couple of problems:
Rails seems unable to load the file even though application.rb contains config.autoload_p...
Ethbun asked 22/9, 2012 at 7:16
1
Solved
I am developing with rails on a mac using the rails console via pry/irb.
When I display a long result in the console ie. Model.all or .really_long_string, I cant seem to get past the string or va...
Beefburger asked 28/7, 2012 at 23:29
2
Solved
Possible Duplicate:
Rails console, how to stop output of return value?
Consider this session in IRB:
>> for a in 1..5 do
?> puts a
>> end
1
2
3
4
5
=> 1..5
>>...
Parfleche asked 23/7, 2012 at 21:46
3
Solved
I am currently editing a file, and I'm using irb to test the api:
> require './file.rb'
> o = Object.new
> o.method
I then want to be able to edit the file.rb, and be able to see change...
4
Solved
I've noticed that objects have their IDs assigned in a counterintuitive fashion. The earlier an object is created, the greater its object ID. I would have thought they would have been assigned in a...
Hillell asked 3/5, 2012 at 0:5
3
Solved
I work on a pretty large rails project at work. Sometimes I need to hunt down class / constant definitions. Is there some built-in method in Ruby to do this for me? Example:
irb> SOME_CONSTANT....
Oao asked 30/3, 2012 at 0:8
2
Solved
I'm doing some design/debugging in IRB and need to login a user and then be able to use current_user in my efforts.
From Brian Deterling's answer to another question, I have been able to successf...
Uppish asked 3/3, 2012 at 7:19
1
Solved
How do i use rails console with the wirble gem? I originally had the code that wirble gives you and put it in my .irbrc
At this point, irb worked fine with wirble (color highlighting), but when i ...
Intradermal asked 23/2, 2012 at 2:20
5
Solved
When I make a new array/hash in irb, it prints out a nice format to show the structure, ex.
["value1", "value2", "value3"]
{"key1" => "value1"}
... but when I try to print out my variables us...
1
Solved
I am trying to get the current ruby version from IRB but its giving me this error:
>> RUBY_VERSION
NoMethodError: undefined method `write' for nil:NilClass
from /usr/local/lib/ruby/1.9.1/ir...
4
Solved
I'm trying to evaluate the expression (a=10) || (rr=20) while the rr variable is not defined
so typing rr in the ruby console before evaluating the previous expression returns
rr
NameError: unde...
2
Solved
So I have this ruby code I grabbed from wikipedia and I modified a bit:
@trie = Hash.new()
def build(str)
node = @trie
str.each_char { |ch|
cur = ch
prev_node = node
node = node[cur]
if node...
1
Solved
def load_lib
path = File.join(File.dirname(__FILE__), 'lib')
failures = []
Dir.glob("#{path}/**/*.rb").each { |file|
puts "loading: #{file} ... "
}
end
There's the script. When I put each l...
© 2022 - 2024 — McMap. All rights reserved.