Class: Rohbau::Interface

Inherits:
Object
  • Object
show all
Includes:
RequestCache, Singleton
Defined in:
lib/rohbau/interface.rb

Defined Under Namespace

Classes: Caller

Instance Method Summary collapse

Methods included from RequestCache

clear, for

Constructor Details

#initializeInterface

Returns a new instance of Interface.



9
10
11
12
13
14
# File 'lib/rohbau/interface.rb', line 9

def initialize
  @calls = Hash.new { |h, k| h[k] = nil }
  @call_count = Hash.new { |h, k| h[k] = 0 }
  @stub_results = Hash.new { |h, k| h[k] = nil }
  @stub_type_for = Hash.new { |h, k| h[k] = nil }
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(domain, *args) ⇒ Object (private)



74
75
76
77
78
# File 'lib/rohbau/interface.rb', line 74

def method_missing(domain, *args)
  use_case = args[0]
  input = args[1] || {}
  call_use_case(domain, use_case, input)
end

Instance Method Details

#call_countObject



31
32
33
# File 'lib/rohbau/interface.rb', line 31

def call_count
  @call_count
end

#callsObject



27
28
29
# File 'lib/rohbau/interface.rb', line 27

def calls
  @calls
end

#clear_cached_requestsObject



23
24
25
# File 'lib/rohbau/interface.rb', line 23

def clear_cached_requests
  RequestCache.clear
end

#clear_stubsObject



16
17
18
19
20
21
# File 'lib/rohbau/interface.rb', line 16

def clear_stubs
  calls.clear
  call_count.clear
  stub_results.clear
  stub_type_for.clear
end