Class: Carbon::Concrete::Item::Struct::Element Private

Inherits:
Object
  • Object
show all
Defined in:
lib/carbon/concrete/item/struct/element.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.

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.

An element of a struct. Contains name and type information, and that's it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type) ⇒ Element

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 element with the given name and type.

Parameters:

  • name (::String)

    The name of the element.

  • type (Type)

    The type of the element.

See Also:



33
34
35
36
37
# File 'lib/carbon/concrete/item/struct/element.rb', line 33

def initialize(name, type)
  @name = name
  @type = type
  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 element.

Returns:

  • (::String)


20
21
22
# File 'lib/carbon/concrete/item/struct/element.rb', line 20

def name
  @name
end

#typeType (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 type of the element.

Returns:



25
26
27
# File 'lib/carbon/concrete/item/struct/element.rb', line 25

def type
  @type
end