Sha256: 67bc244392e8090f7622be98542eb006b821a93aeedabd28d0aba1849975a871
Contents?: true
Size: 831 Bytes
Versions: 6
Compression:
Stored size: 831 Bytes
Contents
require 'pry' module Dotenvious class Configuration class ConfigurationError < StandardError; end def initialize yield self if block_given? end def example_file=(filename) raise ConfigurationError if not_string?(filename) CONFIG[:example_file] = filename end def custom_variables=(vars) raise ConfigurationError unless all_caps_array?(vars) CONFIG[:custom_variables] = vars end def optional_variables=(vars) raise ConfigurationError unless all_caps_array?(vars) CONFIG[:optional_variables] = vars end private def not_string?(filename) filename.class != String end def all_caps_array?(vars) vars.class == Array && vars.all? do |var| var.class == String && var.upcase == var end end end end
Version data entries
6 entries across 6 versions & 1 rubygems