Class: RBI::SigParam
- Inherits:
-
NodeWithComments
- Object
- Node
- NodeWithComments
- RBI::SigParam
- Defined in:
- lib/rbi/model.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
: String.
-
#type ⇒ Object
readonly
: (Type | String).
Attributes inherited from NodeWithComments
Attributes inherited from Node
Instance Method Summary collapse
-
#==(other) ⇒ Object
: (Object other) -> bool.
-
#anonymous? ⇒ Boolean
: -> bool.
-
#initialize(name, type, loc: nil, comments: nil, &block) ⇒ SigParam
constructor
: (String name, (Type | String) type, ?loc: Loc?, ?comments: Array?) ?{ (SigParam node) -> void } -> void.
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(name, type, loc: nil, comments: nil, &block) ⇒ SigParam
: (String name, (Type | String) type, ?loc: Loc?, ?comments: Array?) ?{ (SigParam node) -> void } -> void
1023 1024 1025 1026 1027 1028 1029 |
# File 'lib/rbi/model.rb', line 1023 def initialize(name, type, loc: nil, comments: nil, &block) super(loc: loc, comments: comments) @name = name.to_s #: String @anonymous = name.start_with?("_") #: bool @type = type block&.call(self) end |
Instance Attribute Details
#name ⇒ Object (readonly)
: String
1017 1018 1019 |
# File 'lib/rbi/model.rb', line 1017 def name @name end |
#type ⇒ Object (readonly)
: (Type | String)
1020 1021 1022 |
# File 'lib/rbi/model.rb', line 1020 def type @type end |
Instance Method Details
#==(other) ⇒ Object
: (Object other) -> bool
1037 1038 1039 1040 1041 |
# File 'lib/rbi/model.rb', line 1037 def ==(other) other.is_a?(SigParam) && (name == other.name || anonymous? || other.anonymous?) && type.to_s == other.type.to_s end |
#anonymous? ⇒ Boolean
: -> bool
1032 1033 1034 |
# File 'lib/rbi/model.rb', line 1032 def anonymous? @anonymous end |