Skip to content

Commit d75ffe0

Browse files
committed
Refactor
1 parent 4350ed3 commit d75ffe0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

ruby_event_store/lib/ruby_event_store/specification.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@ class Specification
2020
:with_ids,
2121
:with_types,
2222
) do
23-
def limit? = !to_h[:limit].nil?
24-
def limit = to_h[:limit] || Float::INFINITY
23+
def limit? = !limit.infinite?
2524
def with_ids? = !with_ids.nil?
2625
def with_types? = !(with_types || []).empty?
2726
def forward? = direction.equal?(:forward)
@@ -49,7 +48,7 @@ def initialize(
4948
newer_than: nil,
5049
newer_than_or_equal: nil,
5150
time_sort_by: nil,
52-
limit: nil,
51+
limit: Float::INFINITY,
5352
stream: Stream.new(GLOBAL_STREAM),
5453
read_as: :all,
5554
batch_size: DEFAULT_BATCH_SIZE,
@@ -189,7 +188,7 @@ def backward
189188
def limit(count)
190189
raise InvalidPageSize unless count && count > 0
191190

192-
Specification.new(reader, result.with(limit: count))
191+
Specification.new(reader, result.with(limit: count || Float::INFINITY))
193192
end
194193

195194
# Executes the query based on the specification built up to this point.

0 commit comments

Comments
 (0)