Class: TG::Geometry::Registry
- Inherits:
-
Object
- Object
- TG::Geometry::Registry
- Extended by:
- Forwardable
- Defined in:
- lib/tg/geometry/registry.rb
Constant Summary collapse
- DEFAULT_INDEX_OPTIONS =
{ via: :geojson, strategy: :rtree, predicate: :covers, geometry_index: :ystripes }.freeze
Instance Attribute Summary collapse
-
#index_options ⇒ Object
readonly
Returns the value of attribute index_options.
Class Method Summary collapse
Instance Method Summary collapse
- #index ⇒ Object
-
#initialize(entries: nil, source: nil, **index_options) ⇒ Registry
constructor
A new instance of Registry.
- #loaded? ⇒ Boolean
- #reload! ⇒ Object
Constructor Details
#initialize(entries: nil, source: nil, **index_options) ⇒ Registry
Returns a new instance of Registry.
36 37 38 39 40 41 42 |
# File 'lib/tg/geometry/registry.rb', line 36 def initialize(entries: nil, source: nil, **) @entries = entries @source = source @index_options = self.class..merge().freeze @reload_mutex = Mutex.new @index = nil end |
Instance Attribute Details
#index_options ⇒ Object (readonly)
Returns the value of attribute index_options.
31 32 33 |
# File 'lib/tg/geometry/registry.rb', line 31 def @index_options end |
Class Method Details
.index_options(**options) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/tg/geometry/registry.rb', line 23 def (**) inherited = superclass.respond_to?(:index_options) ? superclass. : DEFAULT_INDEX_OPTIONS return inherited.merge(@index_options || {}).freeze if .empty? @index_options = inherited.merge(@index_options || {}, ).freeze end |
.source(&block) ⇒ Object
18 19 20 21 |
# File 'lib/tg/geometry/registry.rb', line 18 def source(&block) @source = block if block @source || (superclass.source if superclass.respond_to?(:source)) end |