Class: Stub
- Inherits:
-
Object
- Object
- Stub
- Defined in:
- lib/stub.rb
Instance Method Summary collapse
- #called?(method) ⇒ Boolean
-
#initialize ⇒ Stub
constructor
A new instance of Stub.
- #method_missing(m) ⇒ Object
Constructor Details
#initialize ⇒ Stub
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
10 11 12 |
# File 'lib/stub.rb', line 10 def called? (method) @called.has_key? method end |