Class: OpenCPU::DelayedCalculation
- Inherits:
-
Object
- Object
- OpenCPU::DelayedCalculation
- Includes:
- HTTMultiParty
- Defined in:
- lib/opencpu/delayed_calculation.rb
Instance Attribute Summary collapse
-
#available_resources ⇒ Object
Returns the value of attribute available_resources.
-
#location ⇒ Object
Returns the value of attribute location.
Instance Method Summary collapse
- #console ⇒ Object
- #graphics(which = 0, type = :svg) ⇒ Object
- #info ⇒ Object
-
#initialize(location, resources = []) ⇒ DelayedCalculation
constructor
A new instance of DelayedCalculation.
- #source ⇒ Object
- #stdout ⇒ Object
- #value ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize(location, resources = []) ⇒ DelayedCalculation
Returns a new instance of DelayedCalculation.
11 12 13 14 15 |
# File 'lib/opencpu/delayed_calculation.rb', line 11 def initialize(location, resources = []) @location = location @available_resources = {} parse_resources(location, resources) end |
Instance Attribute Details
#available_resources ⇒ Object
Returns the value of attribute available_resources.
9 10 11 |
# File 'lib/opencpu/delayed_calculation.rb', line 9 def available_resources @available_resources end |
#location ⇒ Object
Returns the value of attribute location.
8 9 10 |
# File 'lib/opencpu/delayed_calculation.rb', line 8 def location @location end |
Instance Method Details
#console ⇒ Object
43 44 45 46 |
# File 'lib/opencpu/delayed_calculation.rb', line 43 def console raise ResponseNotAvailableError unless @available_resources.has_key?(:console) process_resource @available_resources[:console].to_s end |
#graphics(which = 0, type = :svg) ⇒ Object
17 18 19 20 21 |
# File 'lib/opencpu/delayed_calculation.rb', line 17 def graphics(which = 0, type = :svg) raise ResponseNotAvailableError unless @available_resources.has_key?(:graphics) raise UnsupportedFormatError unless [:png, :svg].include?(type) process_resource @available_resources[:graphics][which].to_s + "/#{type}" end |
#info ⇒ Object
48 49 50 51 |
# File 'lib/opencpu/delayed_calculation.rb', line 48 def info raise ResponseNotAvailableError unless @available_resources.has_key?(:info) process_resource @available_resources[:info].to_s end |
#source ⇒ Object
38 39 40 41 |
# File 'lib/opencpu/delayed_calculation.rb', line 38 def source raise ResponseNotAvailableError unless @available_resources.has_key?(:source) process_resource @available_resources[:source].to_s end |
#stdout ⇒ Object
28 29 30 31 |
# File 'lib/opencpu/delayed_calculation.rb', line 28 def stdout raise ResponseNotAvailableError unless @available_resources.has_key?(:stdout) process_resource @available_resources[:stdout].to_s end |
#value ⇒ Object
23 24 25 26 |
# File 'lib/opencpu/delayed_calculation.rb', line 23 def value raise ResponseNotAvailableError unless @available_resources.has_key?(:value) process_resource @available_resources[:value].to_s end |
#warnings ⇒ Object
33 34 35 36 |
# File 'lib/opencpu/delayed_calculation.rb', line 33 def warnings raise ResponseNotAvailableError unless @available_resources.has_key?(:warnings) process_resource @available_resources[:warnings].to_s end |