A
Ari Brown
Once again, more questions.
So this is pertaining to my implementation of the name picker app.
When I pick a random name, I then proceed to check if it matches any
name in the used_names file. However, I keep getting a private method
error when I first choose a random line.
ERROR
-----------------------------------------|
namePicker-cli.rb:24:in `random': private method `chop' called for
nil:NilClass (NoMethodError)
from namePicker-cli.rb:22:in `open'
from namePicker-cli.rb:22:in `random'
from namePicker-cli.rb:44
CODE
----------------------------------------|
def random
until @valid == true
File.open(@input_file) do |f| # Open the file
lines = f.readlines # Read the lines
chosen_one = lines[rand(lines.size) + 1].chop # Select a
random one
end
----------------------------------------|
I have no clue why I'm getting this, and I'm almost in tears because
my computer doesn't like me. Help?
-------------------------------------------------------|
~ Ari
crap my sig won't fit
So this is pertaining to my implementation of the name picker app.
When I pick a random name, I then proceed to check if it matches any
name in the used_names file. However, I keep getting a private method
error when I first choose a random line.
ERROR
-----------------------------------------|
namePicker-cli.rb:24:in `random': private method `chop' called for
nil:NilClass (NoMethodError)
from namePicker-cli.rb:22:in `open'
from namePicker-cli.rb:22:in `random'
from namePicker-cli.rb:44
CODE
----------------------------------------|
def random
until @valid == true
File.open(@input_file) do |f| # Open the file
lines = f.readlines # Read the lines
chosen_one = lines[rand(lines.size) + 1].chop # Select a
random one
end
----------------------------------------|
I have no clue why I'm getting this, and I'm almost in tears because
my computer doesn't like me. Help?
-------------------------------------------------------|
~ Ari
crap my sig won't fit