Sha256: 1ee2d04bb89d2b292b10aec7351ec5c09e2dfc4d8cb64905bdcdcc3b8eb86206

Contents?: true

Size: 704 Bytes

Versions: 6

Compression:

Stored size: 704 Bytes

Contents

# frozen_string_literal: true

require 'parse-cron'

module TasksScheduler
  module CronParserPatch
    class TasksSchedulerTimeSource
      class << self
        def local(year, month, day, hour, min, second) # rubocop:disable Metrics/ParameterLists
          Time.utc(year, month, day, hour, min, second)
        end

        def now
          Time.now.utc
        end
      end
    end

    def self.included(base)
      base.class_eval do
        def self.new(source, time_source = TasksSchedulerTimeSource)
          super
        end
      end
    end
  end
end

unless CronParser.included_modules.include?(TasksScheduler::CronParserPatch)
  CronParser.include(TasksScheduler::CronParserPatch)
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
tasks_scheduler-0.9.4 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.9.3 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.9.2 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.9.1 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.9.0 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.8.0 lib/tasks_scheduler/cron_parser_patch.rb