Sha256: 04aa0cd864002acddaad118db4aea017c4c97aac63db70ec8a6cbd6ff93b2dc3

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module NseData
  module Config
    # Base serves as the base class for configuration settings.
    #
    # It allows for storing and accessing various configuration settings
    # through a hash-like interface.
    #
    # @attr_reader [Hash] settings The hash storing configuration settings.
    class Base
      attr_reader :settings

      # Initializes the Base with optional initial settings.
      #
      # @param initial_settings [Hash] Optional hash of initial settings.
      def initialize(initial_settings = {})
        @settings = initial_settings
      end

      # Retrieves a configuration setting by key.
      #
      # @param key [Symbol, String] The key for the setting.
      # @return [Object] The value associated with the key.
      def [](key)
        @settings[key]
      end

      # Sets a configuration setting by key.
      #
      # @param key [Symbol, String] The key for the setting.
      # @param value [Object] The value to set for the key.
      def []=(key, value)
        @settings[key] = value
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nse_data-0.1.1 lib/nse_data/config/base.rb
nse_data-0.1.0 lib/nse_data/config/base.rb