Class: Orangutan::StubBase

Inherits:
Object show all
Includes:
StubInclude
Defined in:
lib/orangutan/stub_base.rb

Instance Method Summary collapse

Methods included from StubInclude

#__react__, #__return__

Constructor Details

#initialize(name, parent, recursive = false) ⇒ StubBase

Returns a new instance of StubBase.



9
10
11
# File 'lib/orangutan/stub_base.rb', line 9

def initialize name, parent, recursive=false
  @name, @parent, @recursive = name, parent, recursive
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/orangutan/stub_base.rb', line 13

def method_missing method, *args
  yield_container, return_container = __react__(method, args)
  if yield_container && block_given?
    yield_container.value.each {|v| yield *v }
  end
  __return__(method, return_container)
end