Class: Carbon::Concrete::Item::Trait::Expectation Private
- Inherits:
-
Object
- Object
- Carbon::Concrete::Item::Trait::Expectation
- Defined in:
- lib/carbon/concrete/item/trait/expectation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
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.
An expectation of a trait. This is a function that an implementing data type must implement to be considered a part of the trait.
Instance Attribute Summary collapse
-
#name ⇒ ::String
readonly
private
The name of the function for this expectation.
-
#parameters ⇒ <Type>
readonly
private
The parameters of the function for this expectation.
-
#return ⇒ Type
readonly
private
The return type of the function for this expectation.
Instance Method Summary collapse
-
#initialize(name, parameters, ret) ⇒ Expectation
constructor
private
Initialize the expectation with the given arguments.
Constructor Details
#initialize(name, parameters, ret) ⇒ Expectation
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the expectation with the given arguments.
45 46 47 48 49 50 |
# File 'lib/carbon/concrete/item/trait/expectation.rb', line 45 def initialize(name, parameters, ret) @name = name @parameters = parameters @return = ret deep_freeze! end |
Instance Attribute Details
#name ⇒ ::String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The name of the function for this expectation. This is a string, and can be any valid function name for a carbon function.
21 22 23 |
# File 'lib/carbon/concrete/item/trait/expectation.rb', line 21 def name @name end |
#parameters ⇒ <Type> (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The parameters of the function for this expectation. This is an array of types, which can contain generic parameters.
27 28 29 |
# File 'lib/carbon/concrete/item/trait/expectation.rb', line 27 def parameters @parameters end |
#return ⇒ Type (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The return type of the function for this expectation. This is a single type, which can contain generic parameters.
33 34 35 |
# File 'lib/carbon/concrete/item/trait/expectation.rb', line 33 def return @return end |