Class: RGeo::ActiveRecord::SpatialFactoryStore
- Inherits:
-
Object
- Object
- RGeo::ActiveRecord::SpatialFactoryStore
- Includes:
- Singleton
- Defined in:
- lib/rgeo/active_record/spatial_factory_store.rb
Defined Under Namespace
Classes: Entry
Instance Attribute Summary collapse
-
#registry ⇒ Object
Returns the value of attribute registry.
Instance Method Summary collapse
- #clear ⇒ Object
- #default(attrs = {}) ⇒ Object
- #default=(factory) ⇒ Object
- #factory(attrs) ⇒ Object
-
#initialize ⇒ SpatialFactoryStore
constructor
A new instance of SpatialFactoryStore.
- #register(factory, attrs = {}) ⇒ Object
Constructor Details
#initialize ⇒ SpatialFactoryStore
Returns a new instance of SpatialFactoryStore.
11 12 13 14 |
# File 'lib/rgeo/active_record/spatial_factory_store.rb', line 11 def initialize @registry = [] @default = nil end |
Instance Attribute Details
#registry ⇒ Object
Returns the value of attribute registry.
9 10 11 |
# File 'lib/rgeo/active_record/spatial_factory_store.rb', line 9 def registry @registry end |
Instance Method Details
#clear ⇒ Object
32 33 34 |
# File 'lib/rgeo/active_record/spatial_factory_store.rb', line 32 def clear @registry = [] end |
#default(attrs = {}) ⇒ Object
20 21 22 |
# File 'lib/rgeo/active_record/spatial_factory_store.rb', line 20 def default(attrs = {}) @default || default_for_attrs(attrs) end |
#default=(factory) ⇒ Object
24 25 26 |
# File 'lib/rgeo/active_record/spatial_factory_store.rb', line 24 def default=(factory) @default = factory end |
#factory(attrs) ⇒ Object
28 29 30 |
# File 'lib/rgeo/active_record/spatial_factory_store.rb', line 28 def factory(attrs) closest_factory(attrs) || default(attrs) end |