Class: ActiveRecordPolyline::Compaction::RandomCompressor
- Defined in:
- lib/active_record_polyline/compaction/random_compressor.rb
Instance Method Summary collapse
- #addable? ⇒ Boolean
-
#initialize(ratio: 0.5) ⇒ RandomCompressor
constructor
A new instance of RandomCompressor.
Methods inherited from Base
#apply, compress_after_push, compress_before_push, #push
Constructor Details
#initialize(ratio: 0.5) ⇒ RandomCompressor
Returns a new instance of RandomCompressor.
6 7 8 |
# File 'lib/active_record_polyline/compaction/random_compressor.rb', line 6 def initialize(ratio: 0.5) @ratio = ratio end |
Instance Method Details
#addable? ⇒ Boolean
10 11 12 |
# File 'lib/active_record_polyline/compaction/random_compressor.rb', line 10 def addable?(*) rand < @ratio end |