Module: Gloss
- Defined in:
- lib/gloss/scope.rb,
lib/gloss/cli.rb,
lib/gloss/utils.rb,
lib/gloss/config.rb,
lib/gloss/errors.rb,
lib/gloss/logger.rb,
lib/gloss/parser.rb,
lib/gloss/source.rb,
lib/gloss/writer.rb,
lib/gloss/runtime.rb,
lib/gloss/version.rb,
lib/gloss/visitor.rb,
lib/gloss/watcher.rb,
lib/gloss/initializer.rb,
lib/gloss/prog_loader.rb,
lib/gloss/type_checker.rb
Overview
This file was generated by Gloss; any changes made here will be overwritten. See / to make changes
Defined Under Namespace
Modules: Errors, Utils Classes: CLI, Initializer, Parser, ProgLoader, Runtime, Scope, Source, TypeChecker, Visitor, Watcher, Writer
Constant Summary collapse
- CONFIG_PATH =
".gloss.yml"
- Config =
OpenStruct.new(default_config: {:frozen_string_literals => true, :src_dir => "src", :entrypoint => nil, :strict_require => false, :type_checking_strictness => "lenient", :prettify_output_executable_path => nil}.freeze)
- VERSION =
"0.1.7"
- OUTPUT_BY_PATH =
Hash.new
Class Method Summary collapse
Class Method Details
.load_config ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/gloss/config.rb', line 15 def self.load_config() user_config = (if File.exist?(File.absolute_path(File.join(Dir.pwd, CONFIG_PATH))) YAML.safe_load(File.read(CONFIG_PATH)) else Config.default_config end) Config.default_config .each() { |k, v| Config.send(:"#{k}=", user_config.[](k.to_s) || v) } end |
.logger ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/gloss/logger.rb', line 6 def self.logger() (if @logger @logger else env_log_level = ENV.fetch("LOG_LEVEL") { || "INFO" } real_log_level = {"UNKNOWN" => Logger::UNKNOWN, "FATAL" => Logger::FATAL, "ERROR" => Logger::ERROR, "WARN" => Logger::WARN, "INFO" => Logger::INFO, "DEBUG" => Logger::DEBUG, "NIL" => nil, nil => nil, "" => nil}.fetch(env_log_level) @logger = Logger.new((if real_log_level STDOUT else IO::NULL end)) .tap() { |l| (if real_log_level l.level=(real_log_level) end) } end) end |