Class: RBS::DefinitionBuilder::MethodBuilder::Methods::Definition
- Inherits:
-
Struct
- Object
- Struct
- RBS::DefinitionBuilder::MethodBuilder::Methods::Definition
- Defined in:
- sig/method_builder.rbs,
lib/rbs/definition_builder/method_builder.rb
Overview
Definition of a method in the type
The Definition object allows invalid method definition so that more than one original definitions may exist.
Instance Attribute Summary collapse
-
#accessibilities ⇒ Object
Returns the value of attribute accessibilities.
-
#name ⇒ Object
Returns the value of attribute name.
-
#originals ⇒ Object
Returns the value of attribute originals.
-
#overloads ⇒ Object
Returns the value of attribute overloads.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #accessibility ⇒ accessibility
-
#initialize ⇒ Definition
constructor
A new instance of Definition.
- #original ⇒ original?
Constructor Details
#initialize ⇒ Definition
Returns a new instance of Definition.
31 |
# File 'sig/method_builder.rbs', line 31
def initialize: (name: Symbol, type: instance_type, originals: Array[original], overloads: Array[overloading_definition], accessibilities: Array[accessibility]) -> void
|
Instance Attribute Details
#accessibilities ⇒ Object
Returns the value of attribute accessibilities
7 8 9 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 7 def accessibilities @accessibilities end |
#name ⇒ Object
Returns the value of attribute name
7 8 9 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 7 def name @name end |
#originals ⇒ Object
Returns the value of attribute originals
7 8 9 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 7 def originals @originals end |
#overloads ⇒ Object
Returns the value of attribute overloads
7 8 9 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 7 def overloads @overloads end |
#type ⇒ Object
Returns the value of attribute type
7 8 9 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 7 def type @type end |
Class Method Details
.empty(name:, type:) ⇒ Definition
22 23 24 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 22 def self.empty(name:, type:) new(type: type, name: name, originals: [], overloads: [], accessibilities: []) end |
Instance Method Details
#accessibility ⇒ accessibility
14 15 16 17 18 19 20 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 14 def accessibility if original.is_a?(AST::Members::Alias) raise "alias member doesn't have accessibility" else accessibilities[0] or raise end end |
#original ⇒ original?
10 11 12 |
# File 'lib/rbs/definition_builder/method_builder.rb', line 10 def original originals.first end |