Class: ActiveRecordPolyline::Compaction::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record_polyline/compaction/base.rb

Direct Known Subclasses

RandomCompressor, SimpleCompressor

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.compress_after_push(method_name = :compress_after_push) ⇒ Object



11
12
13
# File 'lib/active_record_polyline/compaction/base.rb', line 11

def compress_after_push(method_name = :compress_after_push)
  @compress_after_method_name = method_name
end

.compress_before_push(method_name = :compress_before_push) ⇒ Object



7
8
9
# File 'lib/active_record_polyline/compaction/base.rb', line 7

def compress_before_push(method_name = :compress_before_push)
  @compress_before_method_name = method_name
end

Instance Method Details

#apply(polyline) ⇒ Object



16
17
18
# File 'lib/active_record_polyline/compaction/base.rb', line 16

def apply(polyline)
  @polyline = polyline
end

#push(location:, skip_compaction:) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/active_record_polyline/compaction/base.rb', line 20

def push(location:, skip_compaction:)
  return _push(location) if skip_compaction

  call_compaction_method(:before)
  _push(location) if addable?(location)

  call_compaction_method(:after)
end