Class: Rohbau::Interface

Inherits:
Object
  • Object
show all
Includes:
RequestCache
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.



7
8
9
10
11
12
# File 'lib/rohbau/interface.rb', line 7

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)



72
73
74
75
76
# File 'lib/rohbau/interface.rb', line 72

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



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

def call_count
  @call_count
end

#callsObject



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

def calls
  @calls
end

#clear_cached_requestsObject



21
22
23
# File 'lib/rohbau/interface.rb', line 21

def clear_cached_requests
  RequestCache.clear
end

#clear_stubsObject



14
15
16
17
18
19
# File 'lib/rohbau/interface.rb', line 14

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