I am a ruby beginner and I'm to create my own console-twitter for which whenever a user tweets, the app stores de tweet in a hash.
Initially I was able to successfully do this by using
timeline = []
puts "Write your tweet"
newTweet = gets.chomp
date =DateTime.now.strftime("%d/%m/%Y %H%:%M")
@timeline << { :timestamp => date , :tweet => newTweet }
However I was told that by using => i'm using old ruby standars so I want to enhance it by using the below code:
@timeline << { timestamp: date , tweet: newTweet }
Unfortunately I get the following error message for that line of code: syntax error, unexpected ':', expecting '='
Also I'm having doubts on how should i declare the variable timeline
@timeline = []
@timeline = {}
@timeline = Hash.new
Many thanks in advance.