Sha256: e1db8f41e3f08d830e5376f0450ff24d96ba0eb9dc7878c06b379609b3a7184c

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 Bytes

Contents

module Asynchronic
  module DataStore
    class Lookup

      KEYS = [:status, :data, :jobs, :error, :created_at, :queued_at, :started_at, :finalized_at]

      def initialize(job)
        @job = job
      end

      def id
        if @job.parent 
          DataStore::Key.new(@job.parent)[:jobs][@job.id]
        else
          DataStore::Key.new(:job)[@job.id]
        end
      end

      KEYS.each do |key|
        define_method key do
          id[key]
        end
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asynchronic-0.1.0 lib/asynchronic/data_store/lookup.rb