Sha256: 3b542a89905696176b457d8daa6a8ef50f1be12710f3715a5981b3dd4fe950fa

Contents?: true

Size: 841 Bytes

Versions: 4

Compression:

Stored size: 841 Bytes

Contents

class TestClass
  include SuckerPunch::Backgroundable
  
  @@queue = Queue.new
  
  def self.queue
    @@queue
  end
  
  def self.clear
    @@queue.clear
  end
  
  always_background :always1
  def always1
    add_to_queue
  end
  
  def always2(value)
    add_to_queue(value)
  end
  always_background :always2
  
  def normal(value)
    add_to_queue(value)
  end

  always_background :class_always1
  def self.class_always1
    self.class_add_to_queue
  end
  
  def self.class_always2(value)
    self.class_add_to_queue(value)
  end
  always_background :class_always2
  
  def self.class_normal(value)
    self.class_add_to_queue(value)
  end

  private
  
    def add_to_queue(value = 1)
      sleep(0.4)
      @@queue << value
    end

    def self.class_add_to_queue(value = 1)
      sleep(0.4)
      @@queue << value
    end
    
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sucker_punch-backgroundable-0.3.1 spec/test_class.rb
sucker_punch-backgroundable-0.3.0 spec/test_class.rb
sucker_punch-backgroundable-0.2.0 spec/test_class.rb
sucker_punch-backgroundable-0.1.0 spec/test_class.rb