Sha256: 941f4ee28f94b57926de9ad73a6c09c6631400f14e5bd7e9c1a1612135d9730a

Contents?: true

Size: 722 Bytes

Versions: 3

Compression:

Stored size: 722 Bytes

Contents

class Lev::NullStatus
  attr_reader :id

  def initialize(id=nil)
    @id = id || "null-status:#{SecureRandom.uuid}"
    @kill_requested = false
  end

  def request_kill!
    @kill_requested = true
  end

  def kill_requested?
    @kill_requested
  end

  def method_missing(*args, &block)
    nil
  end

  # Provide null object pattern methods for status setter methods called from
  # within routines; routines should not be using other query methods to check
  # their own status (they should know it), with the exception of `kill_requested?`

  def set_progress(*); end
  def save(*); end
  def add_error(*); end

  def queued!; end
  def started!; end
  def succeeded!; end
  def failed!; end
  def killed!; end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lev-7.0.3 lib/lev/null_status.rb
lev-7.0.2 lib/lev/null_status.rb
lev-7.0.1 lib/lev/null_status.rb