Class: RGeo::CoordSys::CRSStore

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/rgeo/coord_sys/crs_to_crs.rb

Overview

Store of all the created CRSToCRS

Defined Under Namespace

Classes: Key

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeCRSStore

Returns a new instance of CRSStore.



33
34
35
36
# File 'lib/rgeo/coord_sys/crs_to_crs.rb', line 33

def initialize
  @store = Hash.new { |h, k| h[k] = CRSToCRS.create(k.from, k.to) }
  @semaphore = Mutex.new
end

Class Method Details

.get(from, to) ⇒ Object



26
27
28
# File 'lib/rgeo/coord_sys/crs_to_crs.rb', line 26

def get(from, to)
  instance.get(from, to)
end

Instance Method Details

#get(from, to) ⇒ Object



38
39
40
41
42
# File 'lib/rgeo/coord_sys/crs_to_crs.rb', line 38

def get(from, to)
  @semaphore.synchronize do
    @store[Key.new(from, to)]
  end
end