Sha256: e58a48b59a21d36e3dbe9d5017a7213b7d09147d23e985819bbab6676517ffd8

Contents?: true

Size: 619 Bytes

Versions: 4

Compression:

Stored size: 619 Bytes

Contents

# This class is used for testing the async_methods plugin functionality.

class AsyncMethods::Tester
  
  attr_reader :test_called, :async_real_method_called
  
  def initialize
    @test_called = 0
    @async_real_method_called = false
  end
  
  def test (arg, delay = 0)
    sleep(delay) if delay > 0
    @test_called += 1
    yield if block_given?
    arg.upcase if arg
  end
  
  def async_real_method
    @async_real_method_called = true
  end
  
  def method_missing (method, *args, &block)
    if method.to_s[0, 5] == 'find_'
      yield if block_given?
      "FINDER"
    else
      super
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
async_methods-1.0.3 spec/method_tester.rb
async_methods-1.0.2 spec/method_tester.rb
async_methods-1.0.1 spec/method_tester.rb
async_methods-1.0.0 spec/method_tester.rb