Class: NoSE::Backend::FileBackend::DeleteStatementStep

Inherits:
Backend::DeleteStatementStep show all
Includes:
RowMatcher
Defined in:
lib/nose/backend/file.rb

Overview

Delete data from an index on the backend

Instance Attribute Summary

Attributes inherited from Backend::StatementStep

#index

Instance Method Summary collapse

Methods included from RowMatcher

#row_matches?, #row_matches_eq?, #row_matches_range?

Methods inherited from Backend::DeleteStatementStep

#initialize

Methods included from Supertype

included

Constructor Details

This class inherits a constructor from NoSE::Backend::Backend::DeleteStatementStep

Instance Method Details

#process(results) ⇒ Object

Remove rows matching the results from the dataset



172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/nose/backend/file.rb', line 172

def process(results)
  # Loop over all rows
  @client[index.key].reject! do |row|
    # Check against all results
    results.any? do |result|
      # If all fields match, drop the row
      result.all? do |field, value|
        row[field] == value
      end
    end
  end
end