Sha256: 4772c4544b35afe8891726fe497b86ddfcab1f43dbe45343b2080ea95163939a
Contents?: true
Size: 718 Bytes
Versions: 3
Compression:
Stored size: 718 Bytes
Contents
require 'yaml' require 'ostruct' module Ginatra def self.config @config ||= OpenStruct.new load_config end # Loads the configuration and merges it with # custom configuration if necessary. # # @return [Hash] config a hash of the configuration options def self.load_config current_path = File.expand_path(File.dirname(__FILE__)) custom_config_file = File.expand_path("~/.ginatra/config.yml") default_config_file = File.expand_path("#{current_path}/../../config.yml") config = YAML.load_file(default_config_file) if File.exist?(custom_config_file) custom_config = YAML.load_file(custom_config_file) config.merge!(custom_config) end config end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ginatra-4.0.2 | lib/ginatra/config.rb |
ginatra-4.0.1 | lib/ginatra/config.rb |
ginatra-4.0.0 | lib/ginatra/config.rb |