Class: Crystalball::RSpec::PredictionPruning::ExamplesPruner
- Inherits:
-
Object
- Object
- Crystalball::RSpec::PredictionPruning::ExamplesPruner
- Defined in:
- lib/crystalball/rspec/prediction_pruning/examples_pruner.rb
Overview
A class to prune given world example groups to fit the limit.
Defined Under Namespace
Classes: ContextIdsSet
Instance Attribute Summary collapse
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#world ⇒ Object
readonly
Returns the value of attribute world.
Instance Method Summary collapse
-
#initialize(rspec_world, to:) ⇒ ExamplesPruner
constructor
A new instance of ExamplesPruner.
-
#pruned_set ⇒ Array<String>
Set of example and context ids to run.
Constructor Details
#initialize(rspec_world, to:) ⇒ ExamplesPruner
Returns a new instance of ExamplesPruner.
28 29 30 31 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 28 def initialize(rspec_world, to:) @world = rspec_world @limit = to end |
Instance Attribute Details
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
24 25 26 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 24 def limit @limit end |
#world ⇒ Object (readonly)
Returns the value of attribute world.
24 25 26 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 24 def world @world end |
Instance Method Details
#pruned_set ⇒ Array<String>
Returns set of example and context ids to run.
34 35 36 37 38 |
# File 'lib/crystalball/rspec/prediction_pruning/examples_pruner.rb', line 34 def pruned_set resulting_set = ContextIdsSet.new world.ordered_example_groups.each { |g| prune_to_limit(g, resulting_set) } resulting_set.to_a end |