lib/sandboxy/configuration.rb in sandboxy-1.1.1 vs lib/sandboxy/configuration.rb in sandboxy-2.0.0

- old
+ new

@@ -1,44 +1,21 @@ module Sandboxy + class Configuration - def self.environment - config = get_config - if config&.key(:environment) - config[:environment] - else - 'live' + attr_accessor :environment + attr_accessor :retain_environment + + def initialize + @environment = 'live' + @retain_environment = false end - end - def self.sandbox? - Sandboxy.environment == 'sandbox' ? true : false - end - - def self.live? - !Sandboxy.sandbox? - end - - def self.retain_environment - config = get_config - if config&.key(:retain_environment) - config[:retain_environment] - else - false + def sandbox? + self.environment == 'sandbox' ? true : false end - end - - private - - - def self.get_config - require 'yaml' - - begin - config = YAML.load_file 'config/sandboxy.yml' - rescue Exception + def live? + !self.sandbox? end - return config if config end - end