Class: RBI::Sig
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::Sig
- Defined in:
- lib/rbi/model.rb
Overview
Sorbet's sigs
Instance Attribute Summary collapse
-
#allow_incompatible_override ⇒ Object
: bool.
-
#allow_incompatible_override_visibility ⇒ Object
: bool.
-
#checked ⇒ Object
: Symbol?.
-
#is_abstract ⇒ Object
: bool.
-
#is_final ⇒ Object
: bool.
-
#is_overridable ⇒ Object
: bool.
-
#is_override ⇒ Object
: bool.
-
#return_type ⇒ Object
: (Type | String).
-
#without_runtime ⇒ Object
: bool.
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
-
#<<(param) ⇒ Object
: (SigParam param) -> void.
-
#==(other) ⇒ Object
: (Object other) -> bool.
-
#add_param(name, type) ⇒ Object
: (String name, (Type | String) type) -> void.
-
#initialize(params: nil, return_type: "void", is_abstract: false, is_override: false, is_overridable: false, is_final: false, allow_incompatible_override: false, allow_incompatible_override_visibility: false, without_runtime: false, type_params: nil, checked: nil, loc: nil, comments: nil, &block) ⇒ Sig
constructor
: ( | ?params: Array?, | ?return_type: (Type | String), | ?is_abstract: bool, | ?is_override: bool, | ?is_overridable: bool, | ?is_final: bool, | ?allow_incompatible_override: bool, | ?allow_incompatible_override_visibility: bool, | ?without_runtime: bool, | ?type_params: Array?, | ?checked: Symbol?, | ?loc: Loc?, | ?comments: Array? | ) ?{ (Sig node) -> void } -> void.
-
#params ⇒ Object
: -> Array.
-
#type_params ⇒ Object
: -> Array.
-
#type_params? ⇒ Boolean
: -> bool.
Methods inherited from NodeWithComments
#annotations, #comments?, #merge_with, #version_requirements
Methods inherited from Node
#compatible_with?, #detach, #merge_with, #parent_conflict_tree, #parent_scope, #print, #rbs_print, #rbs_string, #replace, #satisfies_version?, #string
Constructor Details
#initialize(params: nil, return_type: "void", is_abstract: false, is_override: false, is_overridable: false, is_final: false, allow_incompatible_override: false, allow_incompatible_override_visibility: false, without_runtime: false, type_params: nil, checked: nil, loc: nil, comments: nil, &block) ⇒ Sig
: ( | ?params: Array?, | ?return_type: (Type | String), | ?is_abstract: bool, | ?is_override: bool, | ?is_overridable: bool, | ?is_final: bool, | ?allow_incompatible_override: bool, | ?allow_incompatible_override_visibility: bool, | ?without_runtime: bool, | ?type_params: Array?, | ?checked: Symbol?, | ?loc: Loc?, | ?comments: Array? | ) ?{ (Sig node) -> void } -> void
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 |
# File 'lib/rbi/model.rb', line 1080 def initialize( params: nil, return_type: "void", is_abstract: false, is_override: false, is_overridable: false, is_final: false, allow_incompatible_override: false, allow_incompatible_override_visibility: false, without_runtime: false, type_params: nil, checked: nil, loc: nil, comments: nil, &block ) super(loc: loc, comments: comments) @params = params #: Array[SigParam]? @return_type = return_type @is_abstract = is_abstract @is_override = is_override @is_overridable = is_overridable @is_final = is_final @allow_incompatible_override = allow_incompatible_override @allow_incompatible_override_visibility = allow_incompatible_override_visibility @without_runtime = without_runtime @type_params = type_params #: Array[String]? @checked = checked block&.call(self) end |
Instance Attribute Details
#allow_incompatible_override ⇒ Object
: bool
1044 1045 1046 |
# File 'lib/rbi/model.rb', line 1044 def allow_incompatible_override @allow_incompatible_override end |
#allow_incompatible_override_visibility ⇒ Object
: bool
1047 1048 1049 |
# File 'lib/rbi/model.rb', line 1047 def allow_incompatible_override_visibility @allow_incompatible_override_visibility end |
#checked ⇒ Object
: Symbol?
1063 1064 1065 |
# File 'lib/rbi/model.rb', line 1063 def checked @checked end |
#is_abstract ⇒ Object
: bool
1032 1033 1034 |
# File 'lib/rbi/model.rb', line 1032 def is_abstract @is_abstract end |
#is_final ⇒ Object
: bool
1041 1042 1043 |
# File 'lib/rbi/model.rb', line 1041 def is_final @is_final end |
#is_overridable ⇒ Object
: bool
1038 1039 1040 |
# File 'lib/rbi/model.rb', line 1038 def is_overridable @is_overridable end |
#is_override ⇒ Object
: bool
1035 1036 1037 |
# File 'lib/rbi/model.rb', line 1035 def is_override @is_override end |
#return_type ⇒ Object
: (Type | String)
1029 1030 1031 |
# File 'lib/rbi/model.rb', line 1029 def return_type @return_type end |
#without_runtime ⇒ Object
: bool
1050 1051 1052 |
# File 'lib/rbi/model.rb', line 1050 def without_runtime @without_runtime end |
Instance Method Details
#<<(param) ⇒ Object
: (SigParam param) -> void
1112 1113 1114 |
# File 'lib/rbi/model.rb', line 1112 def <<(param) params << param end |
#==(other) ⇒ Object
: (Object other) -> bool
1122 1123 1124 1125 1126 1127 1128 |
# File 'lib/rbi/model.rb', line 1122 def ==(other) return false unless other.is_a?(Sig) params == other.params && return_type.to_s == other.return_type.to_s && is_abstract == other.is_abstract && is_override == other.is_override && is_overridable == other.is_overridable && is_final == other.is_final && without_runtime == other.without_runtime && type_params == other.type_params && checked == other.checked end |
#add_param(name, type) ⇒ Object
: (String name, (Type | String) type) -> void
1117 1118 1119 |
# File 'lib/rbi/model.rb', line 1117 def add_param(name, type) params << SigParam.new(name, type) end |
#params ⇒ Object
: -> Array
1024 1025 1026 |
# File 'lib/rbi/model.rb', line 1024 def params @params ||= [] end |
#type_params ⇒ Object
: -> Array
1053 1054 1055 |
# File 'lib/rbi/model.rb', line 1053 def type_params @type_params ||= [] end |
#type_params? ⇒ Boolean
: -> bool
1058 1059 1060 |
# File 'lib/rbi/model.rb', line 1058 def type_params? !@type_params.nil? && !@type_params.empty? end |