Sha256: 1da76ce9d695e3515ce759bea47c49000d1cc225ee7022b7809689610eef48ac

Contents?: true

Size: 1.76 KB

Versions: 1

Compression:

Stored size: 1.76 KB

Contents

module Domainic
  module Attributer
    class Attribute
      # A mixin providing common functionality for classes that belong to an Attribute
      #
      # This module provides initialization and duplication behavior for classes that are owned
      # by and work in conjunction with an Attribute instance. These classes typically handle
      # specific aspects of attribute processing such as coercion, validation, or callbacks
      #
      # @api private
      # @!visibility private
      # @author {https://aaronmallen.me Aaron Allen}
      # @since 0.1.0
      module BelongsToAttribute
        @attribute: Attribute

        # Initialize a new instance that belongs to an {Attribute}
        #
        # @param attribute [Attribute] the {Attribute} this instance belongs to
        #
        # @return [BelongsToAttribute] the new BelongsToAttribute instance
        def initialize: (Attribute attribute, *untyped, **untyped) -> void

        # Create a duplicate instance associated with a new {Attribute}
        #
        # @param new_attribute [Attribute] the new attribute to associate with
        #
        # @return [BelongsToAttribute] duplicate instance with new {Attribute}
        def dup_with_attribute: (Attribute attribute) -> BelongsToAttribute

        private

        # Generate a method name for error messages
        #
        # @return [String] formatted method name
        def attribute_method_name: () -> String

        # Ensure that an {Attribute} is a valid {Attribute} instance
        #
        # @param attribute [Attribute] the {Attribute} to validate
        #
        # @raise [TypeError] if the attribute is not a valid Attribute instance
        # @return [void]
        def validate_attribute!: (Attribute attribute) -> void
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
domainic-attributer-0.2.0 sig/domainic/attributer/attribute/mixin/belongs_to_attribute.rbs