Sha256: 937f8211b6d5c843f9795f3ea76d168a99caeecc2e06f9d8b0c4e2ebfc9ee85f

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

# frozen_string_literal: true

module Scim
  module Kit
    module V2
      # Represents a SCIM Attribute
      class Attribute
        include Attributable
        include Templatable
        attr_reader :type
        attr_reader :_value

        def initialize(type:, value: nil)
          @type = type
          @_value = value
          define_attributes_for(type.attributes)
        end

        def _value=(new_value)
          @_value = type.coerce(new_value)

          if type.canonical_values &&
             !type.canonical_values.empty? &&
             !type.canonical_values.include?(new_value)
            raise ArgumentError, new_value
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
scim-kit-0.2.6 lib/scim/kit/v2/attribute.rb
scim-kit-0.2.5 lib/scim/kit/v2/attribute.rb
scim-kit-0.2.4 lib/scim/kit/v2/attribute.rb
scim-kit-0.2.3 lib/scim/kit/v2/attribute.rb
scim-kit-0.2.2 lib/scim/kit/v2/attribute.rb