Sha256: a815717709b61cadd53f496aef7229b24bb1554c79a354029a55b34675096ef5
Contents?: true
Size: 863 Bytes
Versions: 17
Compression:
Stored size: 863 Bytes
Contents
# frozen_string_literal: true module CanvasSync::JobBatches::Compat::Sidekiq module Web module Helpers VIEW_PATH = File.expand_path("../web/views", __dir__) module_function def get_template(name) File.open(File.join(VIEW_PATH, "#{name}.erb")).read end def drain_zset(key) items, _ = CanvasSync::JobBatches::Batch.redis do |r| r.multi do |r| r.zrange(key, 0, -1) r.zremrangebyrank(key, 0, -1) end end yield items end def safe_relative_time(time) time = parse_time(time) relative_time(time) end def parse_time(time) case time when Time time when Integer, Float Time.at(time) else Time.parse(time.to_s) end end end end end
Version data entries
17 entries across 17 versions & 1 rubygems