Class: IActionable::Objects::Progress
- Inherits:
-
IActionableObject
- Object
- IActionableObject
- IActionable::Objects::Progress
- Defined in:
- lib/riaction/iactionable/objects/progress.rb
Instance Attribute Summary collapse
-
#complete ⇒ Object
readonly
Returns the value of attribute complete.
-
#condition_met_date ⇒ Object
Returns the value of attribute condition_met_date.
-
#current_value ⇒ Object
Returns the value of attribute current_value.
-
#description ⇒ Object
Returns the value of attribute description.
-
#required_value ⇒ Object
Returns the value of attribute required_value.
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#initialize(key_values = {}) ⇒ Progress
constructor
A new instance of Progress.
- #percent_complete ⇒ Object
Methods inherited from IActionableObject
timestamp_regexp, timestamp_to_seconds
Constructor Details
#initialize(key_values = {}) ⇒ Progress
Returns a new instance of Progress.
12 13 14 15 16 17 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 12 def initialize(key_values={}) super(key_values) # convert the miliseconds within the date string to seconds (per ruby) # "/Date(1275706032317-0600)/" => "1275706032-0600" @condition_met_date = IActionableObject.(@condition_met_date) unless @condition_met_date.blank? end |
Instance Attribute Details
#complete ⇒ Object (readonly)
Returns the value of attribute complete.
10 11 12 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 10 def complete @complete end |
#condition_met_date ⇒ Object
Returns the value of attribute condition_met_date.
7 8 9 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 7 def condition_met_date @condition_met_date end |
#current_value ⇒ Object
Returns the value of attribute current_value.
8 9 10 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 8 def current_value @current_value end |
#description ⇒ Object
Returns the value of attribute description.
6 7 8 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 6 def description @description end |
#required_value ⇒ Object
Returns the value of attribute required_value.
9 10 11 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 9 def required_value @required_value end |
Instance Method Details
#complete? ⇒ Boolean
19 20 21 22 23 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 19 def complete? Integer(@current_value) >= Integer(@required_value) rescue TypeError => e false end |
#percent_complete ⇒ Object
25 26 27 28 29 |
# File 'lib/riaction/iactionable/objects/progress.rb', line 25 def percent_complete Integer(Float(@current_value) / Integer(@required_value) * 100) rescue TypeError => e 0 end |