lib/head_music/style/mark.rb in head_music-0.11.8 vs lib/head_music/style/mark.rb in head_music-0.11.9
- old
+ new
@@ -4,10 +4,11 @@
def self.for(placement, fitness: nil)
new(placement.position, placement.next_position, placements: [placement], fitness: fitness)
end
def self.for_all(placements, fitness: nil)
- placements = [placements].flatten
+ placements = [placements].flatten.compact
+ return [] if placements.length == 0
start_position = placements.map { |placement| placement.position }.sort.first
end_position = placements.map { |placement| placement.next_position }.sort.last
new(start_position, end_position, placements: placements, fitness: fitness)
end