Sha256: 6e4c54e70520e931e2333d051ba8e7c79c7b70cc709dd5360da4d362ca3d2e2e

Contents?: true

Size: 1.15 KB

Versions: 7

Compression:

Stored size: 1.15 KB

Contents

# encoding: UTF-8
require 'mongo'
require 'mongo_ha'
require 'mongo_mapper'
require 'semantic_logger'
require 'rocket_job/version'

# @formatter:off
module RocketJob
  autoload :CLI,            'rocket_job/cli'
  autoload :Config,         'rocket_job/config'
  autoload :DirmonEntry,    'rocket_job/dirmon_entry'
  autoload :Heartbeat,      'rocket_job/heartbeat'
  autoload :Job,            'rocket_job/job'
  autoload :JobException,   'rocket_job/job_exception'
  autoload :Worker,         'rocket_job/worker'
  module Concerns
    autoload :Worker,       'rocket_job/concerns/worker'
    autoload :Singleton,    'rocket_job/concerns/singleton'
  end
  module Jobs
    autoload :DirmonJob,    'rocket_job/jobs/dirmon_job'
  end

  # @formatter:on
  # Returns a human readable duration from the supplied [Float] number of seconds
  def self.seconds_as_duration(seconds)
    time = Time.at(seconds)
    if seconds >= 1.day
      "#{(seconds / 1.day).to_i}d #{time.strftime('%-Hh %-Mm %-Ss')}"
    elsif seconds >= 1.hour
      time.strftime('%-Hh %-Mm %-Ss')
    elsif seconds >= 1.minute
      time.strftime('%-Mm %-Ss')
    else
      time.strftime('%-Ss')
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rocketjob-1.3.0 lib/rocketjob.rb
rocketjob-1.2.1 lib/rocketjob.rb
rocketjob-1.2.0 lib/rocketjob.rb
rocketjob-1.1.3 lib/rocketjob.rb
rocketjob-1.1.2 lib/rocketjob.rb
rocketjob-1.1.1 lib/rocketjob.rb
rocketjob-1.1.0 lib/rocketjob.rb