Sha256: 2a804093a170ceb093c86d867c7aa02631ce6300ceb7ae916e72fd13f71de2cb

Contents?: true

Size: 714 Bytes

Versions: 2

Compression:

Stored size: 714 Bytes

Contents

# frozen_string_literal: true

require "yaml"

module GeolexicaServer
  module Generator
    # Base class for generators in GeolexicaServer
    class Base
      def self.generate(*args)
        new(*args).generate
      end

      def initialize(options = {})
        config_file_path =
          options["config_file_path"] ||
          GeolexicaServer::DEFAULT_CONFIG_FILE_PATH

        @config = YAML.load_file(config_file_path)

        unless @config["geolexica"] && @config["geolexica"]["glossary_path"]
          raise StandardError,
                "geolexica.glossary_path is missing in config file."
        end

        @glossary_path = @config["geolexica"]["glossary_path"]
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geolexica-server-0.0.1 lib/geolexica_server/generator/base.rb
geolexica-server-0.0.1.pre.beta.pre.32 lib/geolexica_server/generator/base.rb