Module: OpenCPU
- Defined in:
- lib/opencpu.rb,
lib/opencpu/client.rb,
lib/opencpu/errors.rb,
lib/opencpu/version.rb,
lib/opencpu/configuration.rb,
lib/opencpu/delayed_calculation.rb
Defined Under Namespace
Modules: Errors
Classes: Client, Configuration, DelayedCalculation, ResponseNotAvailableError, UnsupportedFormatError
Constant Summary
collapse
- MAJOR =
0
- MINOR =
10
- TINY =
0
- VERSION =
[MAJOR, MINOR, TINY].join('.')
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
19
20
21
|
# File 'lib/opencpu.rb', line 19
def self.configuration
@configuration ||= OpenCPU::Configuration.new
end
|
Class Method Details
.client ⇒ Object
15
16
17
|
# File 'lib/opencpu.rb', line 15
def self.client
OpenCPU::Client.new
end
|
23
24
25
|
# File 'lib/opencpu.rb', line 23
def self.configure
yield(configuration)
end
|
.disable_test_mode! ⇒ Object
32
33
34
35
|
# File 'lib/opencpu.rb', line 32
def self.disable_test_mode!
self.configuration.mode = nil
self.configuration.fake_responses = {}
end
|
.enable_test_mode! ⇒ Object
27
28
29
30
|
# File 'lib/opencpu.rb', line 27
def self.enable_test_mode!
self.configuration.fake_responses = {}
self.configuration.mode = 'test'
end
|
.reset_configuration! ⇒ Object
46
47
48
|
# File 'lib/opencpu.rb', line 46
def self.reset_configuration!
self.configuration.reset!
end
|
.set_fake_response!(package, script, response = nil) ⇒ Object
41
42
43
44
|
# File 'lib/opencpu.rb', line 41
def self.set_fake_response!(package, script, response = nil)
key = [package, script].join('/')
self.configuration.add_fake_response key, response
end
|
.test_mode? ⇒ Boolean
37
38
39
|
# File 'lib/opencpu.rb', line 37
def self.test_mode?
self.configuration.mode == 'test'
end
|