Class: DatasetExplorer::ItemCollector
- Inherits:
-
Object
- Object
- DatasetExplorer::ItemCollector
- Defined in:
- lib/dataset_explorer/item_collector.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #add(item) ⇒ Object
- #explain ⇒ Object
-
#initialize ⇒ ItemCollector
constructor
A new instance of ItemCollector.
Constructor Details
#initialize ⇒ ItemCollector
Returns a new instance of ItemCollector.
5 6 7 8 |
# File 'lib/dataset_explorer/item_collector.rb', line 5 def initialize @keys = [] @evaluators = {} end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
18 19 20 |
# File 'lib/dataset_explorer/item_collector.rb', line 18 def keys @keys end |
Instance Method Details
#add(item) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/dataset_explorer/item_collector.rb', line 20 def add(item) unless item.is_a?(Array) return add_item(item) end item.each do |i| add_item(i, '[]') end end |
#explain ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/dataset_explorer/item_collector.rb', line 10 def explain {}.tap do |explanation| @evaluators.each do |field, evaluator| explanation[field] = evaluator.describe end end end |