D
Derek Smith
Hello all,
I am trying to run File.size? on each file in my hash, yet I am getting
this error.
Goal ==> get file sizes stored in hash from Dir.glob
$ ruby test.rb
yes
test.rb:49:in `size?': can't convert Array into String (TypeError)
from test.rb:49
from test.rb:48:in `each_value'
from test.rb:48
apparently my hash value has to be converted to a string b4 testing it
with File.size?
Wonder if I have to use dirhsh.inspect to convert it to a string first?
$ ruby test.rb
yes
{"vrdevgzlogs"=>["derek.log.gz"], "vrdevlogs"=>["derek.log"]}
{"vrdevgzlogs"=>["derek.log.gz"], "vrdevlogs"=>["derek.log"]}
thank you!
Attachments:
http://www.ruby-forum.com/attachment/3543/test.rb.txt
I am trying to run File.size? on each file in my hash, yet I am getting
this error.
Goal ==> get file sizes stored in hash from Dir.glob
$ ruby test.rb
yes
test.rb:49:in `size?': can't convert Array into String (TypeError)
from test.rb:49
from test.rb:48:in `each_value'
from test.rb:48
apparently my hash value has to be converted to a string b4 testing it
with File.size?
Wonder if I have to use dirhsh.inspect to convert it to a string first?
$ ruby test.rb
yes
{"vrdevgzlogs"=>["derek.log.gz"], "vrdevlogs"=>["derek.log"]}
{"vrdevgzlogs"=>["derek.log.gz"], "vrdevlogs"=>["derek.log"]}
thank you!
Attachments:
http://www.ruby-forum.com/attachment/3543/test.rb.txt