Skip to content

Commit 7ba66db

Browse files
committed
Simpler
1 parent e65d0bd commit 7ba66db

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

ruby_event_store/lib/ruby_event_store/specification.rb

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,12 @@ class Specification
2020
:with_ids,
2121
:with_types,
2222
) do
23-
def initialize(
24-
direction: :forward,
25-
start: nil,
26-
stop: nil,
27-
older_than: nil,
28-
older_than_or_equal: nil,
29-
newer_than: nil,
30-
newer_than_or_equal: nil,
31-
time_sort_by: nil,
32-
limit: nil,
33-
stream: Stream.new(GLOBAL_STREAM),
34-
read_as: :all,
35-
batch_size: Specification::DEFAULT_BATCH_SIZE,
36-
with_ids: nil,
37-
with_types: nil
38-
)
39-
super
40-
end
41-
4223
def limit? = !to_h[:limit].nil?
4324
def limit = to_h[:limit] || Float::INFINITY
44-
def forward? = direction.equal?(:forward)
45-
def backward? = direction.equal?(:backward)
4625
def with_ids? = !with_ids.nil?
4726
def with_types? = !(with_types || []).empty?
27+
def forward? = direction.equal?(:forward)
28+
def backward? = direction.equal?(:backward)
4829
def batched? = read_as.equal?(:batch)
4930
def first? = read_as.equal?(:first)
5031
def last? = read_as.equal?(:last)
@@ -57,7 +38,25 @@ def time_sort_by_as_of? = time_sort_by.equal?(:as_of)
5738

5839
# @api private
5940
# @private
60-
def initialize(reader, result = SpecificationResult.new)
41+
def initialize(
42+
reader,
43+
result = SpecificationResult.new(
44+
direction: :forward,
45+
start: nil,
46+
stop: nil,
47+
older_than: nil,
48+
older_than_or_equal: nil,
49+
newer_than: nil,
50+
newer_than_or_equal: nil,
51+
time_sort_by: nil,
52+
limit: nil,
53+
stream: Stream.new(GLOBAL_STREAM),
54+
read_as: :all,
55+
batch_size: DEFAULT_BATCH_SIZE,
56+
with_ids: nil,
57+
with_types: nil,
58+
)
59+
)
6160
@reader = reader
6261
@result = result
6362
end

0 commit comments

Comments
 (0)