Sha256: 972f7bfefa1adabf388a990d2ca615a8111ad712bee7f3067ca1a5fb14bfb6fc

Contents?: true

Size: 576 Bytes

Versions: 1

Compression:

Stored size: 576 Bytes

Contents

require 'whenever/patches/job'

module Whenever
  class WebJob
    include ActionView::Helpers::DateHelper
    attr_reader :interval

    def initialize job, interval
      @job      = job
      @interval = interval
    end

    delegate :output, :at, to: :@job

    def task
      @job.options[:task]
    end

    def description
      @job.options.fetch(:description) { task }
    end

    def interval
      distance_of_time_in_words(@interval).gsub('about', '')
    rescue ArgumentError
      @interval
    end

    def roles
      @job.roles.join(', ')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
whenever-web-0.0.5 app/models/whenever/web_job.rb