Sha256: 5cd6a35fd732ea79c8f1b77d8fdafb63652c927b952f9cdfb26fe0daa5cf3554
Contents?: true
Size: 682 Bytes
Versions: 7
Compression:
Stored size: 682 Bytes
Contents
require 'iniparse' module Perus class Options def initialize() @defaults = {} end def load(path, defaults) if File.exists?(path) user_options = IniParse.parse(IO.read(path)).to_h else user_options = {} end @options = defaults.merge(user_options) end def method_missing(name, *params, &block) if @options.include?(name.to_s) @options[name.to_s] else @options['__anonymous__'][name.to_s] end end def [](name) @options[name] end end end
Version data entries
7 entries across 7 versions & 1 rubygems