Class: Relaton::Index::Pool
- Inherits:
-
Object
- Object
- Relaton::Index::Pool
- Defined in:
- lib/relaton/index/pool.rb
Overview
Pool of indexes
Instance Method Summary collapse
-
#initialize ⇒ Pool
constructor
A new instance of Pool.
-
#remove(type) ⇒ void
Remove index by type from pool.
-
#type(type, **args) ⇒ Relaton::Index::Type
Return index by type, create if not exists.
Constructor Details
#initialize ⇒ Pool
Returns a new instance of Pool.
7 8 9 |
# File 'lib/relaton/index/pool.rb', line 7 def initialize @pool = {} end |
Instance Method Details
#remove(type) ⇒ void
This method returns an undefined value.
Remove index by type from pool
36 37 38 |
# File 'lib/relaton/index/pool.rb', line 36 def remove(type) @pool.delete type.upcase.to_sym end |
#type(type, **args) ⇒ Relaton::Index::Type
Return index by type, create if not exists
21 22 23 24 25 26 27 |
# File 'lib/relaton/index/pool.rb', line 21 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], args[:pubid_class]) end end |