Skip to content

Commit

Permalink
Allow filters to use any filter type (#88)
Browse files Browse the repository at this point in the history
Co-authored-by: optijon <51177126+optijon@users.noreply.github.com>
  • Loading branch information
dzunk and optijon authored Apr 18, 2024
1 parent 16a98b2 commit a2de75e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Add Ruby 3.2 to build matrix (#82)
* Bump actions versions to v4 (#86)
* Add Ruby 3.3, drop Ruby 2.6 from build matrix (#87)
* Allow filters to use any filter type (#85) (@optijon)

## 0.8.0
* Remove usage of `Redis.current` (#78)
Expand Down
2 changes: 1 addition & 1 deletion lib/redis/time_series/filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def validate!
end

def valid?
!!filters.find { |f| f.is_a? Equal }
!!filters.find { |f| f.is_a?(Equal) || f.is_a?(AnyValue)}
end

def to_a
Expand Down
6 changes: 6 additions & 0 deletions spec/redis/time_series/filters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
it { is_expected.not_to be_valid }
end

context 'with any value filter' do
let(:value) { 'foo=(bar,baz)' }

it { is_expected.to be_valid }
end

context 'with no filters' do
let(:value) { nil }

Expand Down

0 comments on commit a2de75e

Please sign in to comment.