Sha256: 5885e5dc5a9aac288f944bd87307581b360a33113dc7e8766fcc3e1e3cdab0d2

Contents?: true

Size: 794 Bytes

Versions: 1

Compression:

Stored size: 794 Bytes

Contents

module Sandboxy

    def self.environment
        config = get_config
        if config&.key(:environment)
            config[:environment]
        else
            'live'
        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
        end
    end


    private


    def self.get_config
        require 'yaml'

        begin
            config = YAML.load_file 'config/sandboxy.yml'
        rescue Exception
        end

        return config if config
    end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sandboxy-1.1.1 lib/sandboxy/configuration.rb