Why is getting zero income in Ruby
I have a simple method
def save_logline
print "What the name of the movie"
movie_name = gets.strip
print "And what is your precious logline?"
logline = gets.strip
File::open(movie_name + '.txt', 'w') do |f|
f.write(logline)
end
end
Anytime I run the code, I get the first prompt where I paste the movie name, but as soon as I hit the enter button, the second print is called giving me this message.
And what is your precious logline?=> 0
The file is written, but I am not allowed to insert anything into the text file. What's wrong with my logic and how do I fix it? I am using irb in RubyMine with Ubuntu.
EDIT: It looks like due to the reaction of other users to my code and my own test on another development machine, my code just doesn't work on that machine. The only thing I could tell is that I was using the RubyMine irb console. The question should now be a RubyMine problem or is there a big problem with my dev machine?
FINAL EDIT: I checked my second comp which has RubyMine, it looks like it doesn't work in that RubyMine irb console either. I'm going to issue a RubyMine bug and give credit to Jeremy in a day or two in case someone doesn't know why the RubyMine irb is acting funky.
source to share