Sha256: 89a4f99f75c894fee41e8d77355aa6efc4fb7f22e98eefaff1fe450d7a2d6b65
Contents?: true
Size: 1006 Bytes
Versions: 13
Compression:
Stored size: 1006 Bytes
Contents
module Relaton module Index # # Pool of indexes # class Pool def initialize @pool = {} end # # Return index by type, create if not exists # # @param [String] type <description> # @param [String, nil] url external URL to index, used to fetch index for searching files # @param [String, nil] file output file name # @param [Array<Symbol>, nil] id_keys keys to check if index is correct # # @return [Relaton::Index::Type] typed index # def type(type, **args) if @pool[type.upcase.to_sym]&.actual?(**args) @pool[type.upcase.to_sym] else @pool[type.upcase.to_sym] = Type.new(type, args[:url], args[:file], args[:id_keys]) end end # # Remove index by type from pool # # @param [String] type index type # # @return [void] # def remove(type) @pool.delete type.upcase.to_sym end end end end
Version data entries
13 entries across 13 versions & 1 rubygems