Sha256: 6866c68e94534428b5c058c382f8e3221d951e31332421161fc04993d6efc184

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

# frozen_string_literal: true

require_relative '../value_equality'

module RubyTerraform
  module Models
    class Map
      extend Forwardable

      include Enumerable
      include ValueEquality

      def_delegators(
        :@value,
        :rehash, :to_hash, :to_h, :to_a, :to_proc,
        :[], :fetch, :[]=, :store, :default, :default=,
        :default_proc, :default_proc=, :key, :size, :length, :empty?,
        :each_value, :each_key, :each_pair, :each,
        :transform_keys, :transform_keys!,
        :transform_values, :transform_values!,
        :keys, :values, :values_at, :fetch_values,
        :shift, :delete, :delete_if, :keep_if,
        :select, :select!, :filter, :filter!, :reject, :reject!,
        :slice, :except, :clear, :invert, :update, :replace,
        :merge!, :merge, :assoc, :rassoc, :flatten, :compact, :compact!,
        :include?, :member?, :has_key?, :has_value?, :key?, :value?,
        :compare_by_identity, :compare_by_identity?, :any?, :dig,
        :<=, :<, :>=, :>, :deconstruct_keys
      )

      def initialize(value, sensitive: false)
        @value = value
        @sensitive = sensitive
      end

      attr_reader :value

      def sensitive?
        @sensitive
      end

      def state
        [@value, @sensitive]
      end

      def inspect
        sensitive = sensitive? ? 'sensitive' : 'non-sensitive'
        "#{value.inspect} (#{sensitive})"
      end

      alias to_s inspect
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ruby-terraform-1.7.0.pre.3 lib/ruby_terraform/models/map.rb
ruby-terraform-1.7.0.pre.2 lib/ruby_terraform/models/map.rb
ruby-terraform-1.7.0.pre.1 lib/ruby_terraform/models/map.rb