Sha256: 5b73f348c71a60294766a11f3ab7c94fbef77b3aaf7b6abf304a12b0786bc7c7

Contents?: true

Size: 891 Bytes

Versions: 191

Compression:

Stored size: 891 Bytes

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/blank_not_blank'
require 'eac_ruby_utils/core_ext'
require 'eac_config/paths_hash'

module EacConfig
  class OldConfigs
    class Base
      enable_simple_cache

      common_constructor :data, default: [{}] do
        self.data = ::EacConfig::PathsHash.new(data)
      end

      def []=(entry_key, entry_value)
        write(entry_key, entry_value)
      end

      def [](entry_key)
        read(entry_key)
      end

      def clear
        replace({})
      end

      def read(entry_key)
        return nil unless data.key?(entry_key)

        data.fetch(entry_key).if_present(::EacRubyUtils::BlankNotBlank.instance)
      end

      def replace(new_data)
        self.data = ::EacConfig::PathsHash.new(new_data)
      end

      def write(entry_key, entry_value)
        data[entry_key] = entry_value
      end
    end
  end
end

Version data entries

191 entries across 191 versions & 4 rubygems

Version Path
eac_config-0.14.3 lib/eac_config/old_configs/base.rb
eac_tools-0.97.2 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_config-0.14.2 lib/eac_config/old_configs/base.rb
eac_tools-0.82.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.81.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.80.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.79.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_config-0.14.1 lib/eac_config/old_configs/base.rb
eac_tools-0.78.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.77.1 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.77.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.76.1 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.76.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.75.2 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.75.1 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.75.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.74.1 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_tools-0.74.0 sub/eac_config/lib/eac_config/old_configs/base.rb
eac_config-0.14.0 lib/eac_config/old_configs/base.rb
eac_tools-0.73.0 sub/eac_config/lib/eac_config/old_configs/base.rb