I’m running this code and it show the same time but i wanted different dates so i put the sleep so it would change the time in 10 seconds.
But is not changing @date_format
r=Time.now
@date_format = r
def self.asd
puts @date_format
sleep 10
end
def self.asd1
puts @date_format
end
How can i do something like this?
Here is one approach that may work for you:
Hope it helps!