Sha256: ca56770310fa5b1408a5d23d10527a49196182617741b05cc0d726822352abea

Contents?: true

Size: 591 Bytes

Versions: 1

Compression:

Stored size: 591 Bytes

Contents

require "yaml"

module ActiveGeoDb
  class ConnectionConfiguration
    # Key in Rails database configuration under which the configuration for OpenGeoDb database
    # can be found
    CONFIGURATION_KEY = "open_geo_db"

    class << self
      # Read configuration file and load appropriate section
      def load_file(path)
        @configuration_data = YAML.load_file(path)[CONFIGURATION_KEY]
      end

      alias_method(:new, :load_file) # For convenience reasons only...
    end

    # Return previously loaded configuration
    def to_hash
      @configuration_data
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
active_geo_db-0.0.1 lib/active_geo_db/connection_configuration.rb