Sha256: 04af5dffd6446b285d7624407c5a41da7cf54f6e730380d3f0f8e82c2c9bb665

Contents?: true

Size: 1.05 KB

Versions: 3

Compression:

Stored size: 1.05 KB

Contents

require_relative 'iron_worker/utils'
require_relative 'iron_worker/service'
require_relative 'iron_worker/base'
require_relative 'iron_worker/config'
require_relative 'iron_worker/used_in_worker'


module IronWorker
  @@logger = Logger.new(STDOUT)
  @@logger.level = Logger::INFO


  class << self
    attr_accessor :config,
                  :service

    def configure()
      yield(config)
      if config && config.token
        IronWorker.service ||= Service.new(config.token, :config=>config)
      else
        @@logger.warn "No token specified in configure, be sure to set it!"
      end
    end

    def config
      @config ||= Config.new
    end

    def logger
      @@logger
    end

    def api_version
      2
    end

    def is_local?
      !is_remote?
    end

    def is_remote?
      false
    end
  end

end

if defined?(Rails)
#  puts 'Rails=' + Rails.inspect
#  puts 'vers=' + Rails::VERSION::MAJOR.inspect
  if Rails::VERSION::MAJOR == 2
    require_relative 'iron_worker/rails2_init.rb'
  else
    require_relative 'iron_worker/railtie'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
iron_worker-2.3.15 lib/iron_worker.rb
iron_worker-2.3.14 lib/iron_worker.rb
iron_worker-2.3.13 lib/iron_worker.rb