Reputation: 93
I am trying to make hash out of string as so:
hash = eval({"name"=>["name", "changed"], "updated_at"=>[nil, Tue, 31 Dec 2013 09:39:29 EET +02:00]})
but this gives a following error:
SyntaxError: (irb):19: syntax error, unexpected tCONSTANT, expecting ']'
..."updated_at"=>[nil, Tue, 31 Dec 2013 09:39:29 EET +02:00]})
... ^
(irb):19: Invalid octal digit
..._at"=>[nil, Tue, 31 Dec 2013 09:39:29 EET +02:00]})
... ^
How can i proceed with this? Thank you all.
Upvotes: 1
Views: 374
Reputation: 911
write this code as :-
hash = eval({"name"=>["name", "changed"], "updated_at"=>[nil, "Tue, 31 Dec 2013 09:39:29 EET +02:00"]})
or
hash = eval({"name"=>["name", "changed"], "updated_at"=>[nil, Date.today]})
Upvotes: 2