Sha256: 68f5a58c9b1167bb6d25bc4e6632a83ff13353338d6e951f567f6062b47f239e

Contents?: true

Size: 339 Bytes

Versions: 1

Compression:

Stored size: 339 Bytes

Contents

require './lib/model'

class App
	def main
		@score_offset = rand() * 50

		loop do
			s = insert_random
			puts s.score.round(2)
			sleep 0.34
		end
	end

	def insert_random
		s = UserScore.new
		s.user_id = (rand() * 10).to_i
		s.score = rand() * (100 - @score_offset ) + @score_offset
		s.save_changes
		return s
	end
end

App.new.main

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sinatra-liveviews-0.5.0 demo/test-inserts.rb