Class: Gimme::Gives
- Inherits:
-
BlankSlate
- Object
- BlankSlate
- Gimme::Gives
- Defined in:
- lib/gimme/gives.rb
Instance Attribute Summary collapse
-
#raises_no_method_error ⇒ Object
Returns the value of attribute raises_no_method_error.
Instance Method Summary collapse
-
#initialize(double) ⇒ Gives
constructor
A new instance of Gives.
- #method_missing(sym, *args, &block) ⇒ Object
Constructor Details
#initialize(double) ⇒ Gives
Returns a new instance of Gives.
5 6 7 8 |
# File 'lib/gimme/gives.rb', line 5 def initialize(double) @double = double @raises_no_method_error = true end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
10 11 12 13 14 |
# File 'lib/gimme/gives.rb', line 10 def method_missing(sym, *args, &block) sym = ResolvesMethods.new(@double.cls,sym,args).resolve(@raises_no_method_error) Gimme.stubbings.set(@double, sym, args, block) end |
Instance Attribute Details
#raises_no_method_error ⇒ Object
Returns the value of attribute raises_no_method_error.
4 5 6 |
# File 'lib/gimme/gives.rb', line 4 def raises_no_method_error @raises_no_method_error end |