Sha256: ddba8cfb65155d6821e5fe94296ce3fbaf8b6413df5c4599346504832d3cbf2a

Contents?: true

Size: 538 Bytes

Versions: 6

Compression:

Stored size: 538 Bytes

Contents

# frozen_string_literal: true

module SuperSettings
  module Context
    class Current
      def initialize
        @context = {}
        @seed = nil
      end

      def include?(key)
        @context.include?(key)
      end

      def [](key)
        @context[key]
      end

      def []=(key, value)
        @context[key] = value
      end

      def delete(key)
        @context.delete(key)
      end

      def rand(max = nil)
        @seed ||= Random.new_seed
        Random.new(@seed).rand(max || 1.0)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
super_settings-2.1.0 lib/super_settings/context/current.rb
super_settings-2.0.3 lib/super_settings/context/current.rb
super_settings-2.0.2 lib/super_settings/context/current.rb
super_settings-2.0.1 lib/super_settings/context/current.rb
super_settings-2.0.0 lib/super_settings/context/current.rb
super_settings-1.0.2 lib/super_settings/context/current.rb