Class: Outcome
Overview
Represents a specific outcome or key result to be achieved
Instance Attribute Summary collapse
-
#baseline ⇒ Object
Returns the value of attribute baseline.
-
#baseline_date ⇒ Object
Returns the value of attribute baseline_date.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scale ⇒ Object
readonly
Returns the value of attribute scale.
-
#target ⇒ Object
Returns the value of attribute target.
-
#target_date ⇒ Object
Returns the value of attribute target_date.
Instance Method Summary collapse
-
#initialize(name, scale) ⇒ Outcome
constructor
register a name (String) and scale (Scale) of measurement at creation time.
-
#measure ⇒ Object
perform the measurement using the provide scale delegate the details to any class extending Scale.
-
#report ⇒ Object
used to report progress towards goals.
Constructor Details
#initialize(name, scale) ⇒ Outcome
register a name (String) and scale (Scale) of measurement at creation time
13 14 15 16 17 18 |
# File 'lib/mobiusloop/outcome.rb', line 13 def initialize(name, scale) raise "name must not be nil" if name == nil raise "scale must be of type Scale" unless scale.is_a? Scale @name = name @scale = scale end |
Instance Attribute Details
#baseline ⇒ Object
Returns the value of attribute baseline.
6 7 8 |
# File 'lib/mobiusloop/outcome.rb', line 6 def baseline @baseline end |
#baseline_date ⇒ Object
Returns the value of attribute baseline_date.
7 8 9 |
# File 'lib/mobiusloop/outcome.rb', line 7 def baseline_date @baseline_date end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/mobiusloop/outcome.rb', line 5 def name @name end |
#scale ⇒ Object (readonly)
Returns the value of attribute scale.
10 11 12 |
# File 'lib/mobiusloop/outcome.rb', line 10 def scale @scale end |
#target ⇒ Object
Returns the value of attribute target.
8 9 10 |
# File 'lib/mobiusloop/outcome.rb', line 8 def target @target end |
#target_date ⇒ Object
Returns the value of attribute target_date.
9 10 11 |
# File 'lib/mobiusloop/outcome.rb', line 9 def target_date @target_date end |
Instance Method Details
#measure ⇒ Object
perform the measurement using the provide scale delegate the details to any class extending Scale
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mobiusloop/outcome.rb', line 22 def measure begin start_time = Time.now @scale.record_measurement elapsed_time = (Time.now - start_time) return "Success! found " + format_number(@scale.measurements.last) + " " + @name + " in #{elapsed_time.round(1)} seconds!" rescue Exception => e return "Error! Measurement failed with message: " + e. end end |
#report ⇒ Object
used to report progress towards goals
34 35 36 37 38 39 40 |
# File 'lib/mobiusloop/outcome.rb', line 34 def report report = "" report << status report << report_progress report << report_remaining report end |