Class: Gimme::Gives

Inherits:
BlankSlate show all
Defined in:
lib/gimme/gives.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_errorObject

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