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.



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

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)



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

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



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

def call_count
  @call_count
end

#callsObject



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

def calls
  @calls
end

#clear_cached_requestsObject



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

def clear_cached_requests
  RequestCache.clear
end

#clear_stubsObject



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

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