Class: Crystalball::RSpec::PredictionPruning::ExamplesPruner::ContextIdsSet

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeContextIdsSet

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

#idsObject (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

#sizeObject (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