Class: EventStoreRuby::EventFilter
- Inherits:
-
Object
- Object
- EventStoreRuby::EventFilter
- Defined in:
- lib/eventstore_ruby/event_filter.rb
Overview
Describes the subset of events to select when querying the store. Immutable and thread-safe.
Instance Attribute Summary collapse
-
#event_types ⇒ Object
readonly
Returns the value of attribute event_types.
-
#payload_predicates ⇒ Object
readonly
Returns the value of attribute payload_predicates.
Instance Method Summary collapse
-
#initialize(event_types:, payload_predicates: nil) ⇒ EventFilter
constructor
event_types: [String] (required, can be empty for “all types”) payload_predicates: Array<Hash> (optional) – each hash is a partial payload that must match.
Constructor Details
#initialize(event_types:, payload_predicates: nil) ⇒ EventFilter
event_types: [String] (required, can be empty for “all types”) payload_predicates: Array<Hash> (optional) – each hash is a partial payload that must match.
9 10 11 12 13 14 15 16 17 |
# File 'lib/eventstore_ruby/event_filter.rb', line 9 def initialize(event_types:, payload_predicates: nil) unless event_types.is_a?(Array) && event_types.all? { |t| t.is_a?(String) } raise ArgumentError, 'event_types must be an array of strings' end @event_types = event_types.freeze @payload_predicates = payload_predicates&.map(&:freeze)&.freeze freeze end |
Instance Attribute Details
#event_types ⇒ Object (readonly)
Returns the value of attribute event_types.
5 6 7 |
# File 'lib/eventstore_ruby/event_filter.rb', line 5 def event_types @event_types end |
#payload_predicates ⇒ Object (readonly)
Returns the value of attribute payload_predicates.
5 6 7 |
# File 'lib/eventstore_ruby/event_filter.rb', line 5 def payload_predicates @payload_predicates end |