mirror of
https://gitea.invidious.io/iv-org/shard-spectator.git
synced 2024-08-15 00:53:35 +00:00
Store example count instead of recalculating
This commit is contained in:
parent
bcb68a5856
commit
155e9ec81a
1 changed files with 2 additions and 3 deletions
|
@ -15,6 +15,7 @@ module Spectator
|
|||
def children=(children : Array(ExampleComponent))
|
||||
raise "Attempted to reset example group children" if @children
|
||||
@children = children
|
||||
@example_count = children.sum(&.example_count)
|
||||
end
|
||||
|
||||
def each
|
||||
|
@ -27,9 +28,7 @@ module Spectator
|
|||
children.each
|
||||
end
|
||||
|
||||
def example_count : Int
|
||||
children.sum(&.example_count)
|
||||
end
|
||||
getter example_count = 0
|
||||
|
||||
def [](index : Int) : Example
|
||||
raise IndexError.new if index < 0
|
||||
|
|
Loading…
Reference in a new issue