Class: Store::Memory::EqualFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/store/memory.rb

Instance Method Summary collapse

Constructor Details

#initialize(field, value) ⇒ EqualFilter

Returns a new instance of EqualFilter.



207
208
209
210
211
# File 'lib/store/memory.rb', line 207

def initialize field, value
  @field = field.to_s
  @value = value
  @value = "" if value == 'unknown' || value == nil
end

Instance Method Details

#filter(entries) ⇒ Object



213
214
215
216
217
218
219
# File 'lib/store/memory.rb', line 213

def filter entries
  entries.find_all do |entry|
    value2 = entry[@field]
    value2 = '' if value2 == nil
    value2 == @value
  end
end