Sha256: bdee59a429524b6952f9e103dbd698cdb43261079580dc2c9dd1a535c57aa1fa

Contents?: true

Size: 881 Bytes

Versions: 31

Compression:

Stored size: 881 Bytes

Contents

## intended way to use
## take your own date
## find its day id
## then slice the @date_with_weekday_to_epoch starting from that index.
## and check each of its keys for your desired pattern.

$time_hash_strftime_format = "%Y%m%d%w"
begin

	hashes_from_file = JSON.parse(IO.read("#{Rails.root}/app/assets/time_hashes.json")).deep_symbolize_keys
	
	$date_hash = hashes_from_file[date_hash]
	$day_id_hash = hashes_from_file[:day_id_hash]

	

rescue => e

	#puts "there was an error loading the file"
	#puts e.to_s

	$date_hash = {}

	$day_id_hash = {}

	

	nt = Time.now - 24.hours

	6000.times do |n|
		t = nt + n.days
		$day_id_hash[t.strftime($time_hash_strftime_format)] = n 
		$date_hash[t.strftime($time_hash_strftime_format)] = t.to_i
	end


	IO.write("#{Rails.root}/app/assets/time_hashes.json",JSON.generate({:day_id_hash => $day_id_hash, :date_hash => $date_hash}))

end


Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
wordjelly-auth-1.6.0 config/initializers/time_hash.rb
wordjelly-auth-1.5.9 config/initializers/time_hash.rb
wordjelly-auth-1.5.8 config/initializers/time_hash.rb
wordjelly-auth-1.5.7 config/initializers/time_hash.rb
wordjelly-auth-1.5.6 config/initializers/time_hash.rb
wordjelly-auth-1.5.5 config/initializers/time_hash.rb
wordjelly-auth-1.5.4 config/initializers/time_hash.rb
wordjelly-auth-1.5.3 config/initializers/time_hash.rb
wordjelly-auth-1.5.2 config/initializers/time_hash.rb
wordjelly-auth-1.5.1 config/initializers/time_hash.rb
wordjelly-auth-1.5.0 config/initializers/time_hash.rb
wordjelly-auth-1.4.9 config/initializers/time_hash.rb
wordjelly-auth-1.4.8 config/initializers/time_hash.rb
wordjelly-auth-1.4.7 config/initializers/time_hash.rb
wordjelly-auth-1.4.6 config/initializers/time_hash.rb
wordjelly-auth-1.4.5 config/initializers/time_hash.rb
wordjelly-auth-1.4.4 config/initializers/time_hash.rb
wordjelly-auth-1.4.3 config/initializers/time_hash.rb
wordjelly-auth-1.4.2 config/initializers/time_hash.rb
wordjelly-auth-1.4.0 config/initializers/time_hash.rb