Class: Stub

Inherits:
Object
  • Object
show all
Defined in:
lib/stub.rb

Instance Method Summary collapse

Constructor Details

#initializeStub

Returns a new instance of Stub.



2
3
4
# File 'lib/stub.rb', line 2

def initialize
  @called = Hash.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m) ⇒ Object



6
7
8
# File 'lib/stub.rb', line 6

def method_missing(m)
  @called["#{m}"] = "#{m}"
end

Instance Method Details

#called?(method) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/stub.rb', line 10

def called? (method)
  @called.has_key? method
end