Sha256: bd98613e7f0ef831577d7a3f518e71298d37dac7b9f58fb33ac016fce6e645b3

Contents?: true

Size: 802 Bytes

Versions: 7

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

require "pakyow/support/deep_dup"
require "pakyow/support/extension"

module Pakyow
  class Application
    class Connection
      module Behavior
        module Values
          extend Support::Extension
          using Support::DeepDup

          # @api private
          attr_reader :values

          apply_extension do
            after "initialize" do
              @values = {}
            end

            after "dup" do
              @values = @values.deep_dup
            end
          end

          def set?(key)
            @values.key?(key.to_sym)
          end

          def set(key, value)
            @values[key.to_sym] = value
          end

          def get(key)
            @values[key.to_sym]
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pakyow-core-1.0.6 lib/pakyow/application/connection/behavior/values.rb
pakyow-core-1.0.5 lib/pakyow/application/connection/behavior/values.rb
pakyow-core-1.0.4 lib/pakyow/application/connection/behavior/values.rb
pakyow-core-1.0.3 lib/pakyow/application/connection/behavior/values.rb
pakyow-core-1.0.2 lib/pakyow/application/connection/behavior/values.rb
pakyow-core-1.0.1 lib/pakyow/application/connection/behavior/values.rb
pakyow-core-1.0.0 lib/pakyow/application/connection/behavior/values.rb