Sha256: 92d6c6da8666c0021516097435681882107893520e5b2287fce3cc231beee440

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

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

class MethodTester
  
  attr_reader :test_called, :lazy_real_method_called
  
  def initialize
    @test_called = 0
    @lazy_real_method_called = false
  end
  
  def test (arg)
    @test_called += 1
    yield if block_given?
    arg.upcase if arg
  end
  
  def lazy_real_method
    @lazy_real_method_called = true
  end
  
  def method_missing (method, *args, &block)
    if method.to_s.starts_with?('find_')
      yield if block_given?
      "FINDER"
    else
      super
    end
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lazy_methods-1.0.2 spec/method_tester.rb