Class: PredictabilityEngine::DataManager
- Inherits:
-
Object
- Object
- PredictabilityEngine::DataManager
- Defined in:
- lib/predictability_engine/data_manager.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#work_items ⇒ Object
readonly
Returns the value of attribute work_items.
Instance Method Summary collapse
- #active_items ⇒ Object
- #completed_items ⇒ Object
-
#initialize ⇒ DataManager
constructor
A new instance of DataManager.
- #load(spec) ⇒ Object (also: #load_csv)
Constructor Details
#initialize ⇒ DataManager
Returns a new instance of DataManager.
7 8 9 10 |
# File 'lib/predictability_engine/data_manager.rb', line 7 def initialize @work_items = [] @source = nil end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/predictability_engine/data_manager.rb', line 5 def source @source end |
#work_items ⇒ Object (readonly)
Returns the value of attribute work_items.
5 6 7 |
# File 'lib/predictability_engine/data_manager.rb', line 5 def work_items @work_items end |
Instance Method Details
#active_items ⇒ Object
24 25 26 |
# File 'lib/predictability_engine/data_manager.rb', line 24 def active_items @work_items.reject(&:completed?) end |
#completed_items ⇒ Object
20 21 22 |
# File 'lib/predictability_engine/data_manager.rb', line 20 def completed_items @work_items.select(&:completed?) end |
#load(spec) ⇒ Object Also known as: load_csv
12 13 14 15 |
# File 'lib/predictability_engine/data_manager.rb', line 12 def load(spec, **) @source = spec @work_items = DataSources::Factory.for(spec, **).load(spec) end |