or, even simpler:

```ruby
layers.map(&:scroll_end).max
```