Sha256: ac2c5382bf4902bd55a34cf1e3defcff9c9754bf33656f240a0cb43a48bbbe7d

Contents?: true

Size: 712 Bytes

Versions: 22

Compression:

Stored size: 712 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

22 entries across 22 versions & 1 rubygems

Version Path
tasks_scheduler-0.7.0 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.13 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.12 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.11 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.10 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.9 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.8 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.7 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.6 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.5 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.4 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.3 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.2 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.1 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.6.0 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.5.4 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.5.3 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.5.2 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.5.1 lib/tasks_scheduler/cron_parser_patch.rb
tasks_scheduler-0.5.0 lib/tasks_scheduler/cron_parser_patch.rb