Module: CrossStub::Stubber

Extended by:
Forwardable
Defined in:
lib/cross-stub/stubber.rb

Overview

:nodoc:

Defined Under Namespace

Classes: Instance, Klass

Class Method Summary collapse

Class Method Details

.apply(type, thing, stubs) ⇒ Object



13
14
15
16
17
# File 'lib/cross-stub/stubber.rb', line 13

def apply(type, thing, stubs)
  initialize_vars(type, thing, stubs)
  @stubs.values[0].is_a?(::Hash) ?
    apply_stubbing_only : apply_stubbing_and_return_cacheables
end

.unapply(type, thing, stubs) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/cross-stub/stubber.rb', line 19

def unapply(type, thing, stubs)
  initialize_vars(type, thing, stubs)
  @stubs.each do |method, args|
    args[EXIST] ? unapply_aliasing(method) : remove_method(method)
    unstubbify(method)
  end
end