Class: NexosisApi::AlgorithmRun
- Inherits:
-
Object
- Object
- NexosisApi::AlgorithmRun
- Defined in:
- lib/nexosis_api/algorithm_run.rb
Overview
Class to parse results of an algorithm run
Instance Attribute Summary collapse
-
#algorithm ⇒ NexosisApi::Algorithm
Identifier of algorithm run.
-
#links ⇒ Array
Relevant hypermedia as Link.
-
#metrics ⇒ Array
Set of Metric on algorithm.
Instance Method Summary collapse
-
#initialize(run_hash) ⇒ AlgorithmRun
constructor
A new instance of AlgorithmRun.
Constructor Details
#initialize(run_hash) ⇒ AlgorithmRun
Returns a new instance of AlgorithmRun.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nexosis_api/algorithm_run.rb', line 4 def initialize(run_hash) run_hash.each do |k, v| if k == 'metrics' metric_set = [] v.each { |m| metric_set << NexosisApi::Metric.new(m) unless m.nil? } instance_variable_set("@#{k}", metric_set) elsif k == 'links' link_set = [] v.each { |l| link_set << NexosisApi::Link.new(l) unless l.nil? } instance_variable_set("@#{k}", link_set) else instance_variable_set("@#{k}", NexosisApi::Algorithm.new(v)) unless v.nil? end end end |
Instance Attribute Details
#algorithm ⇒ NexosisApi::Algorithm
Identifier of algorithm run
22 23 24 |
# File 'lib/nexosis_api/algorithm_run.rb', line 22 def algorithm @algorithm end |
#links ⇒ Array
Relevant hypermedia as Link
30 31 32 |
# File 'lib/nexosis_api/algorithm_run.rb', line 30 def links @links end |
#metrics ⇒ Array
Set of Metric on algorithm
26 27 28 |
# File 'lib/nexosis_api/algorithm_run.rb', line 26 def metrics @metrics end |