From 6aba66f81c1e8755000deb76ec3bbc40a91aa4ef Mon Sep 17 00:00:00 2001 From: Sergio Bobillier Date: Mon, 16 Feb 2026 16:04:18 +0100 Subject: [PATCH] [BUGFIX] Fix NoMethodError in Elasticsearch::Stats::Indices Fixes a NoMethodError raised by the #system and #user methods of the Elasticsearch::Stats::Indices class when ActiveSupport's String extensions hadn't been loaded yet. The reason for the error was the use of the #starts_with? (from ActiveSupport) method instead of Ruby's built-in #start_with? method. --- CHANGELOG.md | 4 ++++ lib/jay_api/elasticsearch/stats/indices.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed4b727..3b66d31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ Please mark backwards incompatible changes with an exclamation mark at the start ## [Unreleased] +### Fixed +- A `NoMethodError` that was being raised by `Elasticsearch::Stats::Indices` + when `active_support/core_ext/string` hadn't been loaded. + ### Added - It is now possible to configure the type used by the `RSpec::TestDataCollector` class when pushing documents to Elasticsearch. If no type is specified in the diff --git a/lib/jay_api/elasticsearch/stats/indices.rb b/lib/jay_api/elasticsearch/stats/indices.rb index 2770993..f2b8803 100644 --- a/lib/jay_api/elasticsearch/stats/indices.rb +++ b/lib/jay_api/elasticsearch/stats/indices.rb @@ -10,7 +10,7 @@ class Stats class Indices # A lambda used to select / reject system indices (indices whose name # starts with dot). - SYSTEM_SELECTOR = ->(name, _data) { name.starts_with?('.') } + SYSTEM_SELECTOR = ->(name, _data) { name.start_with?('.') } # @param [Hash{String=>Hash}] indices A +Hash+ with the information # about the indices. Its keys are the names of the indices, its values