Sha256: 724c40b5da936d37a9355e6754ad9a9f41d975c2760a8d51b40c2df577f6f66b
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module Overlap class Analysis attr_reader :unions, :segments, :intersections, :quantity_with_intersections, :quantities_with_intersections, :intersection_quantity, :quantities, :quantity def initialize(input_data, options={}) @input_data = input_data @options = options build! end private def build! @unions = Detect.new( Collection.new(@input_data, @options).collection ).overlaps.map do |overlapped_segments| Union.new(overlapped_segments) end @segments = unions.map { |union| union.segment.to_a } @intersections = unions.map { |union| union.intersection_quantity } @intersection_quantity = intersections.reduce(:+) @quantities_with_intersections = unions.map { |union| union.quantity_with_intersections } @quantity_with_intersections = quantities_with_intersections.reduce(:+) @quantities = unions.map { |union| (union.quantity&.round(3) || 0) } @quantity = quantities.reduce(:+)&.round(3) || 0 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
overlap-0.2.0 | lib/overlap/analysis.rb |