Sha256: 6abd35a0c001447050a92ba7cfe4fc709a02cbd6d123e78c0ac83c700ba93085

Contents?: true

Size: 696 Bytes

Versions: 2

Compression:

Stored size: 696 Bytes

Contents

require 'singleton'
require 'yaml'

module CrystalRuby
  def self.config
    Config.instance
  end

  # Define a nested Config class
  class Config
    include Singleton
    attr_accessor :debug, :crystal_src_dir, :crystal_lib_dir, :crystal_main_file, :crystal_lib_name

    def initialize
      # Set default configuration options
      @debug = true
      if File.exist?("crystalruby.yaml")
        @crystal_src_dir, @crystal_lib_dir, @crystal_main_file, @crystal_lib_name =
        YAML.safe_load_file("crystalruby.yaml").values_at("crystal_src_dir","crystal_lib_dir","crystal_main_file", "crystal_lib_name")
      end
    end
  end

  def self.configure
    setup
    yield(config)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
crystalruby-0.1.1 lib/crystalruby/config.rb
crystalruby-0.1.0 lib/crystalruby/config.rb