class Carbon::Concrete::Item::Trait::Expectation

An expectation of a trait. This is a function that an implementing data type must implement to be considered a part of the trait.

@api private @note

**This class is frozen upon initialization.**  This means that any
attempt to modify it will result in an error.  In most cases, the
attributes on this class will also be frozen, as well.

Attributes

name[R]

The name of the function for this expectation. This is a string, and can be any valid function name for a carbon function.

@return [::String] The function name.

parameters[R]

The parameters of the function for this expectation. This is an array of types, which can contain generic parameters.

@return [<Type>] The parameter types.

return[R]

The return type of the function for this expectation. This is a single type, which can contain generic parameters.

@return [Type] The return type.

Public Class Methods

new(name, parameters, ret) click to toggle source

Initialize the expectation with the given arguments.

@see name @see parameters @see return @param name [::String] The name of the function for the expectation. @param parameters [<Type>] The parameters of the function for

the expectation.

@param ret [Type] The return type of the function for the

expectation.
# File lib/carbon/concrete/item/trait/expectation.rb, line 45
def initialize(name, parameters, ret)
  @name = name
  @parameters = parameters
  @return = ret
  deep_freeze!
end