Sha256: 2b932afbb53f8ed5daf66c7ca04abea41a03d5adfc17ee2a1e825844f7c290b6
Contents?: true
Size: 863 Bytes
Versions: 36
Compression:
Stored size: 863 Bytes
Contents
module Lolita class Register def initialize @store = {} end def set key, value, options=nil !!(@store[key] = [value,options].compact) end def get key item = @store[key] and item.first end def get_with_options key @store[key] end def filter *args options = args.extract_options! values = if args.first [get_with_options(args.first)] else @store.values end filter_values(values,options) end private def filter_values values, pattern unless (pattern && pattern.any?) values else values.inject([]) do |result,value| if value[1] if (pattern.to_a - value[1].to_a).empty? result.push value end end result end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems