Class: Yoda::Model::FunctionSignatures::RbsMethod

Inherits:
Base
  • Object
show all
Defined in:
lib/yoda/model/function_signatures/rbs_method.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#wrap

Constructor Details

#initialize(rbs_definition:, rbs_method_definition:, rbs_method_typedef:) ⇒ RbsMethod

Returns a new instance of RbsMethod.

Parameters:

  • rbs_definition (RBS::Definition)
  • rbs_method_definition (RBS::Definition::Method)
  • rbs_method_typedef (RBS::Definition::Method::TypeDef)


17
18
19
20
21
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 17

def initialize(rbs_definition:, rbs_method_definition:, rbs_method_typedef:)
  @rbs_definition = rbs_definition
  @rbs_method_definition = rbs_method_definition
  @rbs_method_typedef = rbs_method_typedef
end

Instance Attribute Details

#rbs_definitionRBS::Definition (readonly)

Returns:

  • (RBS::Definition)


6
7
8
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 6

def rbs_definition
  @rbs_definition
end

#rbs_method_definitionRBS::Definition::Method (readonly)

Returns:

  • (RBS::Definition::Method)


9
10
11
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 9

def rbs_method_definition
  @rbs_method_definition
end

#rbs_method_typedefRBS::Definition::Method::TypeDef (readonly)

Returns:

  • (RBS::Definition::Method::TypeDef)


12
13
14
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 12

def rbs_method_typedef
  @rbs_method_typedef
end

Instance Method Details

#documentString

Returns:

  • (String)


53
54
55
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 53

def document
  rbs_method_typedef.comment&.string || ""
end

#nameString

Returns:

  • (String)


43
44
45
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 43

def name
  rbs_method_typedef.member.name.to_s
end

#namespace_pathString

Returns:

  • (String)


48
49
50
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 48

def namespace_path
  rbs_definition.type_name.to_s
end

#parameter_type_of(param) ⇒ TypeExpressions::Base?

This method is abstract.

Returns:



85
86
87
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 85

def parameter_type_of(param)
  fail NotImplementedError
end

#parametersParameterList

This method is abstract.

Returns:



64
65
66
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 64

def parameters
  ParameterList.from_rbs_method_type(rbs_method_typedef.type)
end

#rbs_type(_env) ⇒ RBS::MethodType

Returns:

  • (RBS::MethodType)


33
34
35
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 33

def rbs_type(_env)
  rbs_method_typedef.type
end

#sepObject



28
29
30
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 28

def sep
  rbs_definition.instance_type? ? "#" : "."
end

#sourcesArray<(String, Integer, Integer)>

Returns:

  • (Array<(String, Integer, Integer)>)


69
70
71
72
73
74
75
76
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 69

def sources
  location = rbs_method_typedef.comment.location
  if location
    [[location.name, *location.start_loc]]
  else
    []
  end
end

#tagsArray<Store::Objects::Tag>

Returns:



58
59
60
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 58

def tags
  []
end

#to_sString

Returns:

  • (String)


79
80
81
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 79

def to_s
  "#{name}#{rbs_method_typedef.type.to_s}"
end

#typeTypeExpressions::FunctionType



24
25
26
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 24

def type
  fail NotImplementedError
end

#visibilitySymbol

Returns:

  • (Symbol)


38
39
40
# File 'lib/yoda/model/function_signatures/rbs_method.rb', line 38

def visibility
  rbs_method_definition.accessibility
end