Sha256: 7f9134e9ae301ed67960299312a2d3e8a56cda006b17519be98d55f953bdc731

Contents?: true

Size: 1000 Bytes

Versions: 1

Compression:

Stored size: 1000 Bytes

Contents

module Sandboxy

    class << self
        attr_accessor :configuration

        def environment
            $sandboxy ||= Sandboxy.configuration.default
            $sandboxy
        end

        def environment= value
            $sandboxy = value
        end

        def method_missing m, *args
            if m.to_s[/(.+)_environment?/]
                self.environment? $1
            else
                super
            end
        end

        def respond_to? m, include_private = false
            super || m.to_s[/(.+)_environment?/]
        end

        def environment? value
            self.environment == value
        end
    end

    def self.configure
        self.configuration ||= Configuration.new
        yield configuration
    end

    class Configuration

        attr_accessor :default
        attr_accessor :retain

        def initialize
            @default = 'live'
            @retain = false
        end

    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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