Class: Poniard::UnknownInjectable
- Inherits:
- BasicObject
- Defined in:
- lib/poniard/injector.rb
Overview
An object that will raise an exception if any method is called on it. This is particularly useful in testing so that you only need to inject the parameters that should actually be called during the test.
Instance Method Summary collapse
-
#initialize(name) ⇒ UnknownInjectable
constructor
A new instance of UnknownInjectable.
- #method_missing(*args) ⇒ Object
Constructor Details
#initialize(name) ⇒ UnknownInjectable
Returns a new instance of UnknownInjectable.
108 109 110 |
# File 'lib/poniard/injector.rb', line 108 def initialize(name) @name = name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
113 114 115 116 |
# File 'lib/poniard/injector.rb', line 113 def method_missing(*args) ::Kernel.raise UnknownParam, "Tried to call method on an uninjected param: #{@name}" end |