Sha256: cbd167d4d6c7d61cb1e250853b97075d4a1fda5f4e13427bbb605d6038744816
Contents?: true
Size: 865 Bytes
Versions: 51
Compression:
Stored size: 865 Bytes
Contents
module Dorsale module SmallData class Filter def initialize(jar) @jar = jar end def store(filters) @jar['filters'] = filters.to_json end def read if @jar['filters'] begin JSON.parse @jar['filters'] rescue JSON::ParserError {} end else {} end end def get(key) read[key.to_s] end def set(key, value) array = read array[key.to_s] = value store(array) end def apply(query) read.each do |key, value| filter = strategy(key) if filter && filter.applies?(self.target) filter.set(key, value) query = filter.apply(query) end end return query end end end end
Version data entries
51 entries across 51 versions & 1 rubygems