Sha256: 6a57d55ba273f57eb6253ca8b8c43c9c1b6a555bf825975b6a223b69141df503

Contents?: true

Size: 1.07 KB

Versions: 3

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

module OpenFeature
  module SDK
    # Metadata structure that defines general metadata relating to a <tt>Provider</tt> or <tt>Client</tt>
    #
    # Within the Metadata structure, the following attribute readers are available:
    #
    # * <tt>name</tt> - Defines the name of the structure
    #
    # * <tt>version</tt> - Allows you to specify version of the Metadata structure
    #
    # Usage:
    #
    #   metadata = Metadata.new(name: 'name-for-metadata', version: 'v1.1.3')
    #   metadata.name # 'name-for-metadata'
    #   metadata.version # version
    #   metadata_two = Metadata.new(name: 'name-for-metadata')
    #   metadata_two == metadata # true - equality based on values
    class Metadata
      attr_reader :name, :version

      def initialize(name:, version: nil)
        @name = name
        @version = version
      end

      def ==(other)
        raise ArgumentError("Expected comparison to be between Metadata object") unless other.is_a?(Metadata)

        @name == other.name && @version == other.version
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openfeature-sdk-0.2.0 lib/open_feature/sdk/metadata.rb
openfeature-sdk-0.1.1 lib/openfeature/sdk/metadata.rb
openfeature-sdk-0.1.0 lib/openfeature/sdk/metadata.rb