M
Maung Aung
Hi all,
I have a question about string usage. I assign @test_string class
variable which is assigned the name of a text file.
@test_string = 'file.txt'
When I was trying to use it as a parameter in a statement
info=File.open(@test_string) {|f| f.read.split},
it said "TypeError: can't convert nil into String". I check the type of
@test_string and it said String object. What am I missing?
Then I try to use to_s method, and it said "Errno::ENOENT: No such file
or directory - "
Could someone explain what is going here? Pls kind on me as I am new to
Ruby.
Thanks,
Maung
I have a question about string usage. I assign @test_string class
variable which is assigned the name of a text file.
@test_string = 'file.txt'
When I was trying to use it as a parameter in a statement
info=File.open(@test_string) {|f| f.read.split},
it said "TypeError: can't convert nil into String". I check the type of
@test_string and it said String object. What am I missing?
Then I try to use to_s method, and it said "Errno::ENOENT: No such file
or directory - "
Could someone explain what is going here? Pls kind on me as I am new to
Ruby.
Thanks,
Maung