Class: Crystalball::RSpec::PredictionPruning::ExamplesPruner::ContextIdsSet
- Inherits:
-
Object
- Object
- Crystalball::RSpec::PredictionPruning::ExamplesPruner::ContextIdsSet
- Defined in:
- lib/crystalball/rspec/prediction_pruning/examples_pruner.rb
Overview
Simple data object for holding context ids array with total examples size
Instance Attribute Summary collapse
-
#ids ⇒ Object
(also: #to_a)
readonly
Returns the value of attribute ids.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #add(id, size = 1) ⇒ Object
-
#initialize ⇒ ContextIdsSet
constructor
A new instance of ContextIdsSet.
Constructor Details
#initialize ⇒ ContextIdsSet
Returns a new instance of ContextIdsSet.
13 14 15 16 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 13 def initialize @size = 0 @ids = [] end |
Instance Attribute Details
#ids ⇒ Object (readonly) Also known as: to_a
Returns the value of attribute ids.
10 11 12 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 10 def ids @ids end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
10 11 12 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 10 def size @size end |
Instance Method Details
#add(id, size = 1) ⇒ Object
18 19 20 21 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 18 def add(id, size = 1) @size += size @ids << id end |